I am currently caching my CSS, JS and images using deflate
in my Apache configuration.
Here's my code:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
Now when I check my header I see:
Host www.domain.com
User-Agent Mozilla/5.0 (X11; Linux i686; rv:6.0.2) Gecko/20100101 Firefox/6.0.2
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip, deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection keep-alive
If-Modified-Since Fri, 30 Sep 2011 01:05:01 GMT
If-None-Match "124741af-1c4b9-4ae1136f3f9d0"
Cache-Control max-age=0
Everything looks good, the Accept-Encoding
is gzip, deflate
which is what I want but now I see the Cache-Control
is max-age=0
.
Will that defeat the purpose of caching using deflate? Is that mean it's only caching for 1 day and the next day it won't cache it or it will have to reload it?
Note: My images rarely change, my CSS and JS change once a week.
These are 2 independent things: mod_deflate and mod_expires
Here's some articles you will find interesting:
http://developer.yahoo.com/performance/rules.html
LiveHttpHeaders: which cache-control info is right
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With