Proper headers for browser caching

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
User avatar
Peter Anselmo
Forum Commoner
Posts: 58
Joined: Wed Feb 27, 2008 7:22 pm

Proper headers for browser caching

Post by Peter Anselmo »

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:

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>
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?
Post Reply