Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to understand the Cache-Control: max-age=0 configuration from below:

This is a snipet from HTTP Live Headers for a static image on our landing page after hitting refresh:

If-Modified-Since: Sat, 23 Jul 2011 02:05:28 GMT
If-None-Match: "21246-eb05-4a8b30415ea00"
**Cache-Control: max-age=0**

HTTP/1.1 304 Not Modified
Date: Tue, 06 Sep 2011 20:59:29 GMT
Server: IBM_HTTP_Server
Connection: Keep-Alive
Keep-Alive: timeout=6
Etag: "21246-eb05-4a8b30415ea00"

I see our Cache-Control shows a max-age=0. I found this explanation:

Cache Control: max-age

This is the HTTP 1.1 equivalent of the earlier Expires header available in HTTP 1.0. It implicitly tells the browser it may cache the page, but must re-validate with the server if the max-age is exceeded. Setting max-age to zero ensures that a page is never served from cache, but is always re-validated against the server.

If that is correct we should never pull the image from the browser cache which if you look at the 304 above is not correct? What does max-age=0 really mean?

We don't have any Caching configurations manually configured in the Apache httpd.conf so I assume we are using defaults for caching/etags.

share|improve this question
up vote 1 down vote accepted

The key is in the last sentence of the explanation you posted:

Setting max-age to zero ensures that a page is never served from cache, but is always re-validated against the server.

In the example you've pasted the client has the asset already in its cache, and it could serve it. However because of the max-age the client will first contact the server and ask if it has been modified. From the server response you pasted it looks like the asset hasn't changed and the server is correctly 're-validating'(304) that the clients version is correct(without actually having to ship the asset over the wire, so there is some benefit).

If the max-age had been something higher the browser could have served the asset up from cache without having to ask the server anything at all.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.