Question

My server returns the following headers for a file:

Accept-Ranges:bytes
Connection:Keep-Alive
Content-Length:155
Content-Type:text/css
Date:Thu, 06 Feb 2014 18:32:44 GMT
ETag:"99000000061b06-9b-4f1c118fdd2f1"
Keep-Alive:timeout=5, max=100
Last-Modified:Thu, 06 Feb 2014 18:32:37 GMT

As you can see, it doesn't return cache-control header, however it returns ETag and Last-Modified headers.

My question is whether browser is going to cache the requested file? I can observr that during the following requests the browser sends ETag:"99000000061b06-9b-4f1c118fdd2f1" in headers and server returns status code 304.

And second question: Will browser cache resource and request it with ETag if Cache-control is set to no-cache?

No correct solution

OTHER TIPS

For first part of question - It is up to your browser (its implementation and configuration) if the response will be cached and when will be revalidated. The only (standardized) difference between browser behaviour with validation headers and behaviour without validation headers is that former one can reduce traffic with server using validation.

Second question: Yes. Browser will cache resource but every time you open the page browser will ask origin server if resource was not modified. If not modified server will respond 304 and browser will display cached content. Otherwise server will send new content.

My guess would be ETag can serve as cache-control: no-cache.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top