Skip to content

Fixes browser cache handling for generated msdf files#700

Open
uguraslan wants to merge 1 commit into
devfrom
fix/msdf-immutable-font-cache
Open

Fixes browser cache handling for generated msdf files#700
uguraslan wants to merge 1 commit into
devfrom
fix/msdf-immutable-font-cache

Conversation

@uguraslan

Copy link
Copy Markdown
Contributor

The dev server's configureServer middleware sends Cache-Control: public, max-age=31536000, immutable for generated MSDF font files. immutable tells the browser the response will never change, so once the files are cached, a normal reload will not request it again even after any change occurs in .ttf/.config.json files and the plugin regenerates files again server-side. Only a hard reload (empty cache) gets the updated files.

This fix replaces immutable with no-cache plus ETag (content hash). The browser still caches the response but always revalidates: unchanged fonts get served from its own cache via a 304, changed fonts trigger a full fetch.

I verified manually in blits-example-app: changed a font's .config.json, confirmed a normal reload now gets the regenerated atlas automatically, and confirmed a reload with no font changes still returns HTTP 304 instead of re-download. Etag implementation should work even very old browser versions.

@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

Test Results: ✅ PASSED

Run at: 2026-07-05T20:47:07.427Z

Summary:
passed: 1328 failed: 0 of 1328 tests

@suresh-gangumalla suresh-gangumalla left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants