clone

an offline sliding-block puzzle game in gleam and lustre, with an endless ladder of puzzles ranked by search

Four hours is a promise this build cannot keep

Dami committed dbdf91b
Cloudflare serves the HTML with max-age=0 and everything else with max-age=14400.
The filenames are not content hashed — klotski.js is always klotski.js — so for
four hours after a deploy a device that already has the bundle answers from its
own disk and never learns there is a new one. The HTML revalidates and points at
the same URL it always did.

The service worker does not save it. It is network-first, which is the right
shape and reads as though it would, but its `fetch` goes through the same HTTP
cache: "network" was already answering from disk. Nothing in the app can see
past that, which is why this is a header and not a code change.

So a _headers file, and max-age=0 with must-revalidate for everything. That is
not "do not cache" — the copy is kept and its ETag revalidates it, so a file that
has not changed costs a conditional request and a 304 with no body. Offline stays
the service worker's job, and it still holds its own copy of every core asset.

The alternative is hashing the bundle's name, which is the better answer for a
big app and the wrong shape for this one: index.html is checked in on purpose so
somebody can read it, and hashed names mean generating it again.
commit
dbdf91b9aa60aa03365455085b53c0972ca952c6
parent
7906417dea964b0b722c4cfd6847888f9cb8a399
author
Dami <dami.etoile@gmail.com>
1 file changed, +17 -0
Aassets/_headers17+++++++++++++++++
A assets/_headers +17 -0