I've got an image on S3, that has a Cache-Control
header set to public, max-age=3600
. So, downstream systems (proxy, browser, etc) should cache it for 1 hour.
I can see the browser returns 304 (not modified) after subsequent requests.
I've then gone and updated that image on S3 (the resource isn't versioned..the URL hasn't changed, just the _content), but the browser went and got the new version. (e.g HTTP 200).
Here's the chrome network traffic:
Requests:
- 200 (ok)
- 304 (not modified)
~ image changed behind the scenes ~
- 200 (ok)
- 304 (not modified)
How is this possible? Am i not setting the correct header?
Two things are confusing me:
- The response should still be 304 (not modified)? How did the browser know to go and get the image?
max-age
hasn't been reached? - Shouldn't chrome show "from disk cache" or whatever? (and not actually go to the server?)
My guess is - i'm not setting the right cache-control header or something. So can someone please shed some light on this behaviour, and let me know what i need to do to cache resources for 1 hour :)
Thanks!