Join 3,520 readers in helping fund MetaFilter (Hide)


Cashy My Apache
July 18, 2007 5:49 PM   Subscribe

I am attempting to configure caching on an Apache server. I have it right for the most part, but.....I would like to prevent browsers from even checking the server once files like images are in the browser cache until an expiry date is exceeded.

As an example, I am placing this in my httpd.conf file:


Header add "Expires" "Mon, 28 Jul 2014 23:30:00 GMT"
Header add "Cache-Control" "max-age=31536000"


mod_expires and mod_headers are turned on. According to Firebug, all of my images are 'caching', but my browser is still checking the server, and is receiving a '304 Not Modified' message. The is good, but not good enough. How can I prevent the browser from checking the server. Once that image is in the cache, I don't want my browser checking the server until after the expiry or max-age is exceeded. Is this possible? According to this article, "You can prevent the contact with the server from happening at all by using the Expires header and the Cache-control header."
posted by jasondigitized to Computers & Internet (2 answers total)
 
I don't know, but there is a bit of a conflict with your "Expires" and "Cache-Control" headers. In one, you say the content is fresh for about 10 years. The other, only 1 year. Perhaps the browser is getting confused.
posted by sbutler at 6:03 PM on July 18, 2007


I believe what you are seeing is a browser setting. Some of the browser settings can override the strict interpretation of the http caching rules. For example the IE setting to Always check the server for new versions of web pages will cause the behavior that you are seeing.
posted by mmascolino at 10:06 PM on July 18, 2007


« Older I have noticed that over the p...   |  My boss has an auto insurance ... Newer »
This thread is closed to new comments.