[PATCH configure] BZ 794755 - Static assets don't set Cache-Control headers https://bugzilla.redhat.com/show_bug.cgi?id=794755

John Eckersberg jeckersb at redhat.com
Tue Feb 21 21:19:15 UTC 2012


Use mod_expires to set expiration for css/js/png to one year.

>From the BZ:

AssetTagHelper appends timestamps as a query parameter, so we can set a
Cache-Control directive allowing these assets to be cached forever -- if we
change a stylesheet, it will end up with a new timestamp in the URL and get
reloaded automatically.
---
 recipes/aeolus/files/aggregator-httpd-ssl.conf |    5 +++++
 recipes/aeolus/files/aggregator-httpd.conf     |    5 +++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/recipes/aeolus/files/aggregator-httpd-ssl.conf b/recipes/aeolus/files/aggregator-httpd-ssl.conf
index fce2f0d..9ace5de 100644
--- a/recipes/aeolus/files/aggregator-httpd-ssl.conf
+++ b/recipes/aeolus/files/aggregator-httpd-ssl.conf
@@ -24,6 +24,11 @@ Alias /fonts "/usr/share/aeolus-conductor/public/fonts"
 
 RewriteRule ^/conductor/images/(.*).(png|jpg|gif|svg)$ /conductor/graphics/$1.$2 [R]
 
+ExpiresActive on
+ExpiresByType text/css "access plus 1 year"
+ExpiresByType text/javascript "access plus 1 year"
+ExpiresByType image/png "access plus 1 year"
+
 ProxyPass /conductor/graphics !
 ProxyPass /conductor/stylesheets !
 ProxyPass /conductor/errors !
diff --git a/recipes/aeolus/files/aggregator-httpd.conf b/recipes/aeolus/files/aggregator-httpd.conf
index 567d648..8a0331e 100644
--- a/recipes/aeolus/files/aggregator-httpd.conf
+++ b/recipes/aeolus/files/aggregator-httpd.conf
@@ -19,6 +19,11 @@ Alias /fonts "/usr/share/aeolus-conductor/public/fonts"
 
 RewriteRule ^/conductor/images/(.*).(png|jpg|gif|svg)$ /conductor/graphics/$1.$2 [R]
 
+ExpiresActive on
+ExpiresByType text/css "access plus 1 year"
+ExpiresByType text/javascript "access plus 1 year"
+ExpiresByType image/png "access plus 1 year"
+
 ProxyPass /conductor/graphics !
 ProxyPass /conductor/stylesheets !
 ProxyPass /conductor/errors !
-- 
1.7.7.6




More information about the aeolus-devel mailing list