You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cross-host 301s are browser-cacheable, pinning clients through a route reclassification #183
src/middleware.ts emits cross-host redirects with noCache-Control:
// 307 preserves method + body on POST/PUT/DELETE; 301 is fine for GET/HEAD// navigation. No Cache-Control: browser redirect cache is plenty, and// CDN-caching the redirect would pin clients to the wrong host if we ever// re-balance the route split.conststatus=method==="GET"||method==="HEAD" ? 301 : 307;returnnewResponse(null,{ status,headers: {Location: redirectTarget}});
The comment identifies the right hazard — "would pin clients to the wrong host if we ever re-balance the route split" — but guards only the CDN. A bare 301 is heuristically cacheable by the browser, and Chrome/Safari cache permanent redirects aggressively and persistently. So the pinning it warns about happens anyway, one layer closer to the user, and in the one cache we cannot purge.
Why it isn't hypothetical
#181 was exactly that re-balance. /api/notices was 301'd from app.nemar.org to ww2.nemar.org for roughly twenty minutes between the Phase 5 deploy (#179) and the fix (#182). Every browser that loaded an app-host page in that window ran the banner's fetch("/api/notices") and may now hold a cached permanent redirect. For those clients the banner stays broken after the fix, and no server-side change reaches them — it clears only on a hard reload or cache eviction.
Low blast radius this time: the window was short and production has zero notices, so nothing is being hidden. The mechanism is the concern, not this instance.
Fix
Add Cache-Control: no-store to cross-host redirect responses (both the getCrossHostRedirect and getRetiredRedirect branches).
Cost is negligible — these are empty-body redirects on paths that are, by definition, requested on the wrong host — and it makes route reclassification a deploy rather than a per-user cache problem. Alternatively, drop GET to 302, but no-store is more explicit about the intent and keeps the semantically-correct 301 for the retired-path redirects, which genuinely are permanent.
Worth pairing with a note in AGENTS.md: reclassifying a route between hosts is a change that outlives the deploy, so the redirect must not be cacheable.
Activity