Optimize horizon cache and compress for http response
Leverage the browser cache and compress to speed up the file transfer. In RHEL based image, the expire and deflate module are enabled in default. In the Debian based image, only the deflate is enabled * Enable expire module on the Debian based image * Enable the expire for the assets resource * Enable the deflate for the http response Closes-Bug: #1605907 Change-Id: If25decc38a10a21929f72a89cdb350d4ac64a5a9
This commit is contained in:
parent
661c6a059f
commit
ed1b3dc929
@ -24,4 +24,48 @@ Listen {{ api_interface_address }}:80
|
||||
|
||||
{% if kolla_enable_tls_external | bool %}
|
||||
Header edit Location ^http://(.*)$ https://$1
|
||||
{% else %}
|
||||
# NOTE(Jeffrey4l): Only enable deflate when tls is disabled until the
|
||||
# OSSN-0037 is fixed.
|
||||
# see https://wiki.openstack.org/wiki/OSSN/OSSN-0037 for more information.
|
||||
<IfModule mod_deflate.c>
|
||||
# Compress HTML, CSS, JavaScript, Text, XML and fonts
|
||||
AddOutputFilterByType DEFLATE application/javascript
|
||||
AddOutputFilterByType DEFLATE application/rss+xml
|
||||
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
|
||||
AddOutputFilterByType DEFLATE application/x-font
|
||||
AddOutputFilterByType DEFLATE application/x-font-opentype
|
||||
AddOutputFilterByType DEFLATE application/x-font-otf
|
||||
AddOutputFilterByType DEFLATE application/x-font-truetype
|
||||
AddOutputFilterByType DEFLATE application/x-font-ttf
|
||||
AddOutputFilterByType DEFLATE application/x-javascript
|
||||
AddOutputFilterByType DEFLATE application/xhtml+xml
|
||||
AddOutputFilterByType DEFLATE application/xml
|
||||
AddOutputFilterByType DEFLATE font/opentype
|
||||
AddOutputFilterByType DEFLATE font/otf
|
||||
AddOutputFilterByType DEFLATE font/ttf
|
||||
AddOutputFilterByType DEFLATE image/svg+xml
|
||||
AddOutputFilterByType DEFLATE image/x-icon
|
||||
AddOutputFilterByType DEFLATE text/css
|
||||
AddOutputFilterByType DEFLATE text/html
|
||||
AddOutputFilterByType DEFLATE text/javascript
|
||||
AddOutputFilterByType DEFLATE text/plain
|
||||
AddOutputFilterByType DEFLATE text/xml
|
||||
</IfModule>
|
||||
{% endif %}
|
||||
|
||||
<IfModule mod_expires.c>
|
||||
<Filesmatch "\.(jpg|jpeg|png|gif|js|css|swf|ico|woff)$">
|
||||
ExpiresActive on
|
||||
ExpiresDefault "access plus 1 month"
|
||||
ExpiresByType application/javascript "access plus 1 year"
|
||||
ExpiresByType text/css "access plus 1 year"
|
||||
ExpiresByType image/x-ico "access plus 1 year"
|
||||
ExpiresByType image/jpg "access plus 1 year"
|
||||
ExpiresByType image/jpeg "access plus 1 year"
|
||||
ExpiresByType image/gif "access plus 1 year"
|
||||
ExpiresByType image/png "access plus 1 year"
|
||||
Header merge Cache-Control public
|
||||
Header unset ETag
|
||||
</Filesmatch>
|
||||
</IfModule>
|
||||
|
@ -44,6 +44,7 @@ RUN {{ macros.install_packages(horizon_packages | customizable("packages")) }}
|
||||
RUN echo > /etc/apache2/ports.conf \
|
||||
&& sed -i 's|\(ServerTokens \)OS|\1Prod|' /etc/apache2/conf-available/security.conf \
|
||||
&& ln -s ../mods-available/headers.load /etc/apache2/mods-enabled/headers.load \
|
||||
&& ln -s ../mods-available/expires.load /etc/apache2/mods-enabled/expires.load \
|
||||
&& cp /usr/share/openstack-dashboard/openstack_dashboard/conf/*.json /etc/openstack-dashboard \
|
||||
&& sed -i "s|WEBROOT='/horizon/'|WEBROOT = '/'|" /etc/openstack-dashboard/local_settings.py \
|
||||
&& sed -i "s|^POLICY_FILES_PATH|POLICY_FILES_PATH = '/etc/openstack-dashboard'|" /etc/openstack-dashboard/local_settings.py \
|
||||
|
Loading…
Reference in New Issue
Block a user