开发者

Caching Images, JS and CSS in Apache using deflate

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
AddOutputF开发者_如何学运维ilterByType 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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜