0

Serving up images that don't seem to cache

There's a LAPP stack (postgresql instead of mysql) running over on http://ninjawars.net. 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: http://www.ninjawars.net/attack_player.php

Here is an example image (they're probably all being served exactly the same): http://www.ninjawars.net/images/characters/fighter.png 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:http://www.ninjawars.net/images/characters/fighter.png 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:http://www.ninjawars.net/images/characters/fighter.png 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?

Kzqai
  • 1,278
  • 4
  • 18
  • 32

1 Answers1

1

mod_expires

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

cagenut
  • 4,848
  • 2
  • 24
  • 29
  • 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 00:07
  • I haven't used them myself but SimpleCDN looks like a fit. – cagenut May 18 '10 at 14:24