fix(health-freshness): revalidate every poll — CF browser-TTL rewrite oscillates synthesized-OK sources to stale (#4910)#4912
Merged
Conversation
… would oscillate synthesized-OK sources to stale (#4910) Cloudflare's zone Browser-Cache-TTL override rewrites the compact health endpoint's max-age=0 to 30min (observed live post-#4908). Synthesized-OK sources compute freshness from checkedAt against the 15-min FRESH_THRESHOLD, so a browser-cached body 15-30min old flips every healthy badge to stale, then back on the next cache window — oscillating ~30min waves. fetch cache: 'no-cache' forces revalidation on every poll; Cloudflare answers from its 60s edge cache, so the #4907 origin collapse is intact and checkedAt stays well under threshold. Fixes #4910 Claude-Session: https://claude.ai/code/session_01YKrVoDp8TfEKLYXo83kPFV
koala73
enabled auto-merge (squash)
July 5, 2026 17:52
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4910. Post-deploy follow-up to #4907 / PR #4908.
Problem
Live probing after #4908 deployed showed the Cloudflare zone's Browser Cache TTL override rewrites the compact health endpoint's
Cache-Control: public, max-age=0, must-revalidatetopublic, max-age=1800, must-revalidate— browsers cache the body for up to 30 minutes. Since PR #4905, healthy checks are synthesized as OK-as-of-checkedAtand compared against the 15-minFRESH_THRESHOLD, so a tab reading a 15–30-min-old cached body computes age > threshold and flips every healthy source badge tostale, then back tofreshwhen the browser cache window rolls — oscillating ~30-min waves.(The CDN side works as intended:
CDN-Cache-Control: public, s-maxage=60is respected —cf-cache-status: HIT+x-vercel-cache: HITobserved, origin collapse confirmed.)Fix
cache: 'no-cache'on the client health fetch: the browser revalidates every poll, Cloudflare answers from its 60s edge cache, so the #4907 origin collapse is intact andcheckedAtstays ≤ ~60s + poll interval old — far under threshold. This is also the correct standing declaration for a freshness poller and is robust against future CF browser-TTL config drift.Verification
cache: 'no-cache'on the fetch init; 14/14 pass intests/data-freshness-health.test.mts.npm run typecheckclean; tiered pre-push gate green.https://claude.ai/code/session_01YKrVoDp8TfEKLYXo83kPFV