Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

Serving up images that don't seem to cache

There's a LAPP stack (postgresql instead of mysql) running over on I just recently noticed that images don't seem to be caching with any kind of good frequency as I was reloading a page with a few images on it here:

Here is an example image (they're probably all being served exactly the same): Checking the header, it seems that the caching is set to: Cache-Control:max-age=0

(the full header for this image, like all the others, is...

Request URL: Request Method:GET Status Code:200 OK Request Headers Accept:application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,/;q=0.5 Cache-Control:max-age=0 Referer: User-Agent:Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.3 Safari/533.4 Response Headers Accept-Ranges:bytes Content-Length:938 Content-Type:image/png Date:Thu, 13 May 2010 21:24:07 GMT ETag:"ffd4d-3aa-4837efc120540" Last-Modified:Mon, 05 Apr 2010 15:28:45 GMT Server:Apache


So what modules or config or htaccess or whatever do I change to have it cache images, e.g. for 24 hours?

share|improve this question


But what you really want to do is move them off to a CDN.

share|improve this answer
Err, you mean like a third-party CDN? Do you have one that you recommend that I could use or something? – Kzqai May 13 '10 at 23:43
I mean, I'm vaguely aware of amazon's s3 stuff, but I wasn't really aware of any other major push to act as a CDN for arbitrary person. – Kzqai May 14 '10 at 0:07
I haven't used them myself but SimpleCDN looks like a fit. – cagenut May 18 '10 at 14:24

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.