This page is part of a static HTML representation of the TiddlyWiki at https://tiddlywiki.com/

WebServer Parameter: use-browser-cache

 13th April 2024 at 5:08am

The web server configuration parameter use-browser-cache=yes activates 200 OK browser caching via the Cache-Control header and a smart a Etag header:

  • The server javascript creates an MD5 hash object.
  • Adds the data of the current request:response (for example: json text or an image binary) to the hash object.
  • Adds the current headers of the response to the hash object.
  • If the response data has an encoding value, adds the encoding to the hash object.
  • Calculates the final MD5 hash string as a contentDigest javascript variable, and saves it as an Etag: "<<contentDigest>>" header.

If the incoming request contains a header named if-none-match, then the server will check the generated Etag against all values.

If any if-none-match value DOES match the current Etag, the server will send a 304 NOT MODIFIED response with the current response headers, instead of the data with a 200 OK response.

This saves bandwidth, as the client can be sure they have already received the exact data and has it in their current cache.

If use-browser-cache=no (or any other value including null), then the server will return a Cache-Control: no-store header by default.

If any customer server route module defines custom Cache-Control header behavior, then the server will pass that header through instead of the default.