Search code examples
cachingapache2cache-control

can you make browser assume that content is valid/serve it from it's cache? eliminating 304's


Is it possible, to set up apache to serve a combination of headers so that client (browser) will:

  • see that the content is flagged to be valid (for example image expires 10 years from now)
  • has the content in it's cache
  • doesn't ask server 'is that content valid' - as it will always get http 304 status

basically, is it possible to tell browser "don't ask server if that image is valid, if you have it in your cache it means its valid, no exceptions!"?


Solution

  • OK, here's what I discovered.

    If a person clicks an url, than if the headers (expire time) is set properly (far into the future), than the browser will optimalize, and dont ask for that particular resource.

    If you click refresh, it will force the browser to ask for all resources (and mostly get a lot of 304's).