Notes: Caching

Browser Cache

HTTP headers used for browser caching. The following is generally a good one to use for a balance of fresh files + cache efficiency.

Cache-Control: public, max-age=0, s-maxage=60, must-revalidate
public
The response can be cached by both a shared proxy and the browser.
private
The response should not be cached by a shared proxy, only by the browser.
max-age=0
The number of seconds a proxy or browser should cache the response, before being considered stale.
s-maxage=60
The number of seconds a shared cache (proxy) should cache the response, before being considered stale.
must-revalidate
The browser or proxy will re-request the file whilst also sending a hash of the current file it has (via the request header If-None-Match=<etag provided with the initial file repsonse>). The server or proxy will compare the hash with its current file and send back either a 304 Not Modified header response, or a 200 Ok response with the contents of the updated file.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control