On Sun, May 4, 2014 at 10:58 PM, Gilles Dubuc <gilles(a)wikimedia.org> wrote:
It seems like the browser will not always pick
up/respect the
Cache-Control directive for the browser cache (I don't know why, could be
specific to my machine/OS X and I've wasted many hours already trying to
figure it out). I've found a workaround, which is using
Last-Modified/If-Modified-Since (which will trigger the 304 mechanism) in
addition to Cache-Control:
https://gerrit.wikimedia.org/r/131425 It's
probably worth having that in general anyway, for older browsers.
After some testing and googling, it seems at least Firefox and Chrome
ignore max-age when you refresh the page (but not when you navigate via
links). Is it possible that you ran into that?
This comment in the Chromium tracker has some explanation:
https://code.google.com/p/chromium/issues/detail?id=1906#c6
I verified that this affects AJAX requests as well - the API requests are
not cached when I press F5, but cached when I click on the "Page" tab
(which links to itself) and reopen the same image.
Some of the answers to this SO question have a lot of details about caching
behavior across browsers:
http://stackoverflow.com/q/385367/323407