Firefox cache images more than cache-control: max-age

Ivan Toman ivtoman at
Thu Aug 23 13:48:45 UTC 2012


Some visitors of my site complain about their Firefox is pulling images 
from cache, whereas it should not do that, because images on the site 
are changing few times a day. In other words, .png images that are 
static, always have same file name, but few times a day they get 
overwriten with new ones. When visitor loads web page, fresh versions of 
images must be displayed, but Firefox ofted pulls them from it's cache. 
I don't have any report of other browsers than FF is doing that problem. 
However, I don't found issue myself; browsing all the time with Firefox 
on Linux at home, and also few Firefox on Windows on work and everything 
is OK. This is why I cannot track issue very well.

In nginx configuration I allowed little bit of caching (6 minutes) so 
when visitor loads page again in a short period of time they can be 
cached versions, but not for a long time, say few hours! So I set:

         location / {
             root   html;
             index  index.html index.htm;
             autoindex on;
             expires 6m;

Checking with Live HTTP Headers I'm getting these responses for images:

GET /images/gfs/06z/pcs/pcs_18.png HTTP/1.1
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20100101 
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.7,hr;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive

HTTP/1.1 200 OK
Date: Thu, 23 Aug 2012 13:05:55 GMT
Content-Type: image/png
Content-Length: 31313
Last-Modified: Thu, 23 Aug 2012 09:34:29 GMT
Connection: keep-alive
Expires: Thu, 23 Aug 2012 13:11:55 GMT
Cache-Control: max-age=360
Accept-Ranges: bytes

So I think everything should be set to cache images for 360 seconds (6 
minutes) and when image is loaded after that time pass, they have to be 
pulled from server again, not from cache.

What can I do to help those users who has to refresh page manually every 
time they want to see fresh images?

Thanks in advance,

More information about the nginx mailing list