Cache Control – Server vs. Client

The server can set Cache-Control as far as it wants but if the client browser (Firefox, IE, etc.) says something else, the client rules. For example: an image with proper server’s Cache-control and Expires headers. If the client says “Cache-control: max-age=0” in its request, a conditional GET request will send and HTTP 304 code would return from the server. The expected and best behavior would be no request at all.

It’s not the server’s fault, it’s done its part correctly. The client is now in control and it seems Firefox and IE on my machine don’t like caching that much. So 304’s instead of zero request for now.

Update: Firefox actually is pretty smart on this. If you click F5, Refresh or a direct reload, it will send cache-control: max-age=0. It means the server will return 304’s. But if you move from one page to the next and the page reuse other cached component, Firefox won’t make any request at all, which is the expected behavior. Now I can sleep tight knowing that our pages are faster as fewer conditional GET requests are made.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *