How can I configure apache to cache the images that it is serving? Right now it is giving headers t

Posted by Tchalvak on Server Fault See other posts from Server Fault or by Tchalvak
Published on 2010-05-13T21:03:10Z Indexed on 2010/05/13 21:04 UTC
Read the original article Hit count: 354

Filed under:
|

Serving up images that don't seem to cache

There's a LAPP (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?

© Server Fault or respective owner

Related posts about apache

Related posts about caching