SharePointVault ~/gotchas/tooling ⌕ Search 459 pages, error messages, scripts…Ctrl K ★ Star
M↓ README.mdM↓ azure-front-door-stale-pointer-file-two-cache-tiers.md
sharepoint-vault›gotchas›tooling›azure-front-door-stale-pointer-file-two-cache-tiers.mdhistoryedit on GitHub
● GOTCHAtooling· 3 min read

Azure Front Door serves a stale pointer file for longer than max-age after you publish

applies to: SPFx solutions (or any web app) whose loader reads a fixed-URL JSON index from a CDN behind Azure Front Door Standard/Premium to decide which build to loadreviewed: 2026-11-17#cdn#azure-front-door#caching#s-maxage#deployment#spfx

Versioned bundles can be cached forever, but the small file that points at them (versions.json, a release index) has a fixed URL and changes on every publish. Behind Azure Front Door with Cache-Control: max-age=600 it can stay stale for well over 10 minutes, because Front Door caches through more than one layer, may serve expired copies, and keeps a separate copy for each compression variant. Give pointer files a short s-maxage (Front Door prefers it over max-age), and when you test, send the same Accept-Encoding: br the browser sends.

Verzované bundly se smí cachovat napořád, ale malý soubor, který na ně ukazuje (versions.json, index vydání), má pevnou adresu a mění se při každé publikaci. Za Azure Front Doorem s Cache-Control: max-age=600 může zůstat starý i přes 10 minut, protože Front Door cachuje ve víc vrstvách, smí vydat i prošlou kopii a pro každou variantu komprese drží vlastní kopii. Ukazatelům dej krátké s-maxage (Front Door ho upřednostní před max-age) a při testu posílej stejné Accept-Encoding: br jako prohlížeč.

Symptom

  • You publish a new build and update the index. For 5–12 minutes the loader in the browser still gets the previous index, doesn't find the new version, and falls back to an older one.
  • curl https://cdn.example.com/app/index.json returns the new file the whole time, so the CDN "looks fine".
  • The difference looks like it depends on the Origin header (browser fetch vs. curl). It doesn't.

Cause

Response headers from Front Door tell the story:

Vary: Accept-Encoding
Cache-Control: max-age=600
X-Cache: TCP_HIT
X-Cache-Info: L1_T2
  1. TTL comes from the origin. Front Door takes the cache duration from s-maxage, then max-age, then Expires (Caching with Azure Front Door – Cache expiration). With max-age=600 every cached copy lives 600 s from when it was stored.
  2. Longer than one max-age. We measured stale responses for up to ~12 minutes with max-age=600. The responses carry X-Cache-Info: L1_T2, so they pass through more than one cache layer, and Microsoft states that Front Door "might be able to serve data from the cache even if the cached data has expired". Don't plan on stale data disappearing after exactly max-age.
  3. One copy per compression variant and per edge node. With Vary: Accept-Encoding, br, gzip and uncompressed responses are cached separately. Browsers always ask for br, so that variant is always warm and stale. A plain curl asks for the uncompressed variant, which nobody requested recently. It gets TCP_MISS, goes to the origin, and returns fresh bytes. Origin is not part of the cache key.
  4. fetch(url, { cache: 'no-cache' }) doesn't help. It makes the browser revalidate with the edge, not with your origin. The edge answers from its own copy.

Fix

Give the files that change on every publish a short shared-cache TTL and keep the browser TTL:

Cache-Control: max-age=600, s-maxage=60
  • On Azure Blob Storage (static website) this is the blob's x-ms-blob-cache-control property, so set it per file in your upload script: pointer files get s-maxage, versioned files keep max-age.
  • Only the pointers need it. Versioned bundles and hashed chunks never change, and long caching is what you want there.
  • Purging after every deploy is weaker. It can take up to 10 minutes to propagate, and the deploy identity needs permission to purge on the Front Door profile, on top of write access to storage.
  • no-cache/no-store from the origin turns Front Door caching off for that file completely. That works too, but every page load then reaches the origin.

On the client: if the loader finds that the version it wants is missing from the index, it should first fetch the index once more with a cache-busting query (?t=<now>; Front Door includes the query string in the cache key only if the route is configured that way). Only then should it fall back. And it shouldn't cache that fallback for longer than the edge TTL.

How to check

Compare X-Cache, ETag and Last-Modified the way a browser would see them:

curl -s -o /dev/null -D - -H "Accept-Encoding: br" https://cdn.example.com/app/index.json | grep -iE "x-cache|etag|last-modified|cache-control"

Without the Accept-Encoding header you are testing a different cached copy.

Was this helpful?ask or add your experience on GitHub →
Saved you an hour? A star on GitHub helps other SharePoint people find the vault.★ Star on GitHub
last reviewed: 2026-11-17last updated: 2026-11-17historyedit on GitHubview source