1 Commits

Author SHA1 Message Date
Spinnich
61c3dd1e4c fix(nginx): cache only fingerprinted assets, revalidate the rest
RomM's nginx served everything under /assets, plus the root favicons and
manifest, with no Cache-Control, so browsers re-fetched or revalidated the
frontend bundle and every cover image on repeat visits.

Only some of these assets are safe to cache long-term, so a blanket immutable
rule is unsafe. Cache by fingerprint instead:

- Content-hashed bundles (index-<hash>.js) and library resources that carry a
  cache-busting query (covers ?ts=, manuals ?v=) -> public, max-age=31536000,
  immutable.
- Query-less library resources (screenshots and RA badges, which reuse stable
  filenames and are overwritten on re-scrape), the bundled EmulatorJS/Ruffle
  runtimes, and other static files under /assets -> public, max-age=3600,
  must-revalidate.
- index.html and the root favicons/manifest/service worker -> no-cache, so a
  new deploy's bundles and any updated runtime are picked up at once.

The resources split is driven by an $is_args map, so a resource is frozen only
while its URL carries a busting query.

Fixes #3890

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-22 22:23:21 +00:00