Skip to content

perf(frontend): cache hashed assets and fonts long, revalidate index.html on Firebase - #609

Merged
JuliusHenke merged 1 commit into
masterfrom
perf/frontend-firebase-cache-headers
Oct 12, 2026
Merged

JuliusHenke merged 1 commit into
masterfrom
perf/frontend-firebase-cache-headers

Conversation

@JuliusHenke

Copy link
Copy Markdown
Member

What

Cache headers in frontend/firebase.json for the Vite build output:

  • assets/** and *.woff2 get max-age=31536000, immutable. The old rule targeted the CRA-era static/** path, which does not exist anymore, so the fonts had no long cache header.
  • / and /index.html get no-cache (revalidate with ETag, a cheap 304). Without it Firebase's default one hour cache can serve an old index.html that references hashed chunks of a previous deploy.

Firebase Hosting already compresses text responses (gzip/Brotli), so no compression change is needed. Permalinks use the URL hash, so the app is only entered via / or /index.html.

Verification

Only the JSON syntax is checked locally, the headers cannot be exercised without a Firebase deploy. After deploying, check:

curl -sI https://tormap.org/ | grep -i cache-control        # no-cache
curl -sI https://tormap.org/assets/<hashed file> | grep -i cache-control   # max-age=31536000, immutable

Dependencies

None.

Deployment notes

None beyond the usual Firebase deploy.

🤖 Generated with Claude Code

…html on Firebase

Vite emits hashed files to /assets (the old rule matched the CRA-era static/ path), so fonts had no long cache header. index.html now revalidates, so a new deploy is picked up immediately and never references already purged chunks from a stale copy.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@JuliusHenke JuliusHenke added enhancement New feature or request frontend labels Oct 12, 2026
@github-actions

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 0c1001c):

https://tormap-36f44--pr609-perf-frontend-fireba-h2us8ioj.web.app

(expires Wed, 11 Nov 2026 17:28:51 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 0c1f71965de18e60b0e686b0d0356977fec090dc

@JuliusHenke
JuliusHenke marked this pull request as ready for review October 12, 2026 17:53
@JuliusHenke
JuliusHenke merged commit 0bd1a64 into master Oct 12, 2026
14 of 15 checks passed
@JuliusHenke
JuliusHenke deleted the perf/frontend-firebase-cache-headers branch October 12, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant