Proper headers for browser caching
Posted: Wed Jun 03, 2009 12:02 am
Hi All,
I have several pages with many small images that almost never change. I've noticed that much of my page load time is just sending and receiving headers. Rather than having the browser make a request for every item on every single refresh and receive a bunch of "304 not modified" responses, I'd like the browser to default to it's cache instead. I've read around, and implemented the following in my apache config file:
I've tried both varieties show above, and I've verified that they are in fact being sent using firebug. Although everything seems to go smoothly, every file will still be requested on the next load. Any Ideas?
I have several pages with many small images that almost never change. I've noticed that much of my page load time is just sending and receiving headers. Rather than having the browser make a request for every item on every single refresh and receive a bunch of "304 not modified" responses, I'd like the browser to default to it's cache instead. I've read around, and implemented the following in my apache config file:
Code: Select all
ExpiresActive On
<FilesMatch "\.(gif|jpg|jpeg|png|js|css|pdf)$">
Header set Cache-Control max-age=86400
# Header set ExpiresDefault "access plus 1 day"
</FilesMatch>