newbie
newbie

Reputation: 1515

Http Caching : Cache-Control

I'm serving an image, with the header set in response as :

Cache-Control : max-age=600000

As I understand, the image should now be treated as cache-able for the next 600000 seconds. However i find Chrome constantly issuing a conditional request for the image every time i refresh the page using the last modified date :

If-Modified-Since: Thu, 19 Apr 2012 14:51:08 GMT

And since the image has not changed on the server, a 304 Not Modified response is issued.

So my question is How do i prevent Chrome from issuing a conditional request all together? when i directed that it's okay to cache the image for the next 600000 seconds, then why does it need to check with the server everytime? I would expect it to only check after 600000 seconds.

Upvotes: 2

Views: 518

Answers (1)

newbie
newbie

Reputation: 1515

The reason why the browser was issuing a conditional request is because I was manually refreshing the browser.

When a user manually refreshes the page by clicking the refresh button (normal refresh), a conditional request is issued irrespective of the max-age.

When a user Ctrl+clicks the refresh button (super refresh), an unconditional request is issued irrespective of the max-age.

Under normal navigation (clicking links) the browser won't issue any request when the max-age is valid.

Upvotes: 5

Related Questions