No expires header sent, content cached, how long until browser makes conditional GET request?

Michael McCracken picture Michael McCracken · May 2, 2011 · Viewed 18k times · Source

Assume browser default settings, and content is sent without expires headers.

  1. user visits website, browser caches images etc.
  2. user does not close browser, or refresh page.
  3. user continues to surf site normally.
  4. assume the browse doesn't dump the cache for any reason.

The browser will cache images etc as the user surfs, but it's unclear when it will issue a conditional GET request to ask about content freshness (apart from refreshing the page). If this is a browser specific setting, where can I see it's value (for browsers like: safari, IE, FireFox, Chrome).

[edit: yes - I understand that you should always send expires headers. However, this research is aimed at understanding how the browser works with content w/o expires headers.]

Answer

Peter Hart picture Peter Hart · Jan 27, 2017

From the the HTTP caching spec (section 13.4): Unless specifically constrained by a cache-control (section 14.9) directive, a caching system MAY always store a successful response (see section 13.8) as a cache entry, MAY return it without validation if it is fresh, and MAY return it after successful validation. This means that a user agent is free to do whatever it wants if no cache control header is sent. Most browsers use a combination of user settings and heuristics to determine whether (and how long) to cache in this situation.