Expand description
How the served web UI is cached by a browser. A headless server serves the built UI from a folder, and the
package’s files carried one fixed modification date, no validator and no Cache-Control: a browser then kept the
old shell (index.html) for weeks, and a revalidation by that date was answered “not modified” after the server was
upgraded, so a normal reload kept showing the old version.
The rules, by file:
/assets/*(Vite names each by its content hash): cached for a year and immutable.private, because the server answers on the person’s own address only.- every other file (
index.html, which also answers any path no file claims,early-boot.js,/fonts/*and/fontawesome/*, none of which carry a hash):no-cache, so the browser asks again each time, with anETagof the file’s content, so a file that did not change costs a304and one that did is sent whole. - no file is ever dated:
Last-Modifiedis dropped, and anIf-Modified-Sinceis not heard, because a browser that cached an older server’s file holds only that date to ask with, and the answer to it must be the file.
Constants§
- IMMUTABLE 🔒
- MAX_
HASHED_ 🔒BYTES - The longest file given an
ETag(it is read whole to hash it): the largest un-hashed file is a font. - REVALIDATE 🔒