Use mod_expires to set cache headers for log files

Our CI jobs' logserver wasn't setting cache headers so browsers were
always downloading the log files on each request. Reduce load on the
logserver and improve performance by users via the setting of a 2 week
ttl on log data.

This should be safe because each job writes to a uuid identified dir and
that data doesn't get overwritten. Once written the data is static.

Change-Id: Ic99df4e4e64a6bf64e68e6f1bc297c91134ab716
This commit is contained in:
Clark Boylan 2019-04-05 14:09:00 -07:00
parent 19a6b1bea8
commit 23425ea940
3 changed files with 12 additions and 0 deletions

View File

@ -69,6 +69,12 @@ class openstackci::logserver (
}
}
if ! defined(Httpd::Mod['expires']) {
httpd::mod { 'expires':
ensure => present,
}
}
::httpd::vhost { "logs.${domain}":
port => 80,
priority => '50',

View File

@ -65,6 +65,9 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %>
Order allow,deny
allow from all
Satisfy Any
ExpiresActive On
# Data in the logs server is static once generated by a job
ExpiresDefault "access plus 2 weeks"
</Directory>
<Directory /usr/local/lib/python2.7/dist-packages/os_loganalyze>
Allow from all

View File

@ -68,6 +68,9 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %>
Order allow,deny
allow from all
Satisfy Any
ExpiresActive On
# Data in the logs server is static once generated by a job
ExpiresDefault "access plus 2 weeks"
</Directory>
<Directory /usr/local/lib/python2.7/dist-packages/os_loganalyze>
Allow from all