published fresh until

Cloudflare: bypass authenticated cache and trace staleness

Summary Exclude login, account and session-bearing requests from shared cache; preserve origin prohibitions and place bypass after broad cache rules. Start with Cache eligibility: Bypass cache

Not for general origin cache-header selection; see cdn-serves-old-page-or-another-users-page-cache-control-headers.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: set Cache eligibility: Bypass cache for authenticated routes and real session-cookie requests, after broader cache rules, before purging stale objects.

Short answer

As of November 2026, use current Cloudflare Cache Rules docs. Separate public assets from login/account/cart/API responses and session-bearing traffic. A Status code TTL setting can result in Cloudflare removing Set-Cookie and caching the asset. Preserve origin private/no-store and explicit request bypass boundaries. Cookie behavior, origin directives.

Choose / don't choose

  • Bypass: choose for auth callbacks, login/account/checkout and responses personalized by cookies or authorization; don't assume session cookies separate shared entries. Match real auth mechanisms. Login guidance, cookie rule.
  • Eligible public content: choose only responses identical for all matching visitors; don't use whole-host caching without exclusions. Settings.
  • Targeted purge: choose when affected URL/variants are known; don't flush unrelated objects for one stale page. Fix eligibility before purging. Purge scope.

Not for: general origin cache-header selection; see cdn-serves-old-page-or-another-users-page-cache-control-headers.

Settings that matter

Setting or flagValue / defaultApplies toSource
Cache eligibilityBypass cache on sensitive paths/session requestsCurrent Cache RulesSettings
Edge TTL / edge_ttl.modeUse cache-control if present, bypass if absent = bypass_by_default on eligible public paths; preserves prohibitionsCurrent Cache RulesTTL settings
edge_ttl.moderespect_origin follows present directives, uses default behavior if absent; avoid override_origin for personalized responsesCurrent Cache RulesTTL settings
Browser TTL / browser_ttl.modeRespect origin / respect_origin; don't override private-response policyCurrent Cache RulesBrowser settings
http.cookie expressionDocumented expression uses http.cookie contains "test-cookie"; the expression is shown using the Expression EditorCurrent Cache RulesCookie example
Origin Cache-Controlprivate, no-store on private responses; With Origin Cache Control on, no-cache caches and always revalidatesCurrent origin/HTTP behaviorDirectives
Purge request filesFull URLs; include custom-key header variants; purge_everything: true only for zone-wide needPOST /zones/{zone_id}/purge_cacheAPI

Cache Rules stack; conflicting values use the last matching rule. Put broad caching before auth/session bypass; ensure no later rule re-enables it. Specificity alone does not win. Priority.

Order of operations

1. Compare a disposable URL anonymously and as two separate users. Capture CF-Cache-Status, Age, origin cache headers, body identity and Set-Cookie; inspect each redirect hop without sharing credentials. Statuses. 2. Compare authorized origin diagnostics with edge behavior. HIT means cached; STALE means expired content served when origin could not be reached. DYNAMIC can mean request bypass; Responses that Cloudflare chooses not to cache return BYPASS instead of MISS. MISS alone does not establish safety. Statuses. 3. Narrow public caching; add route/session bypass last. Remove overriding/status-code TTL on private paths. Cookie absence does not make login/callback HTML public. Settings, login guidance. 4. Purge polluted URLs with POST /zones/{zone_id}/purge_cache and {"files":["https://example.com/account"]}. Include custom-key headers/variants. A redirect purge leaves its destination cached. Prefer prefix/tag scopes when variants cannot be enumerated; purge everything only for a broad incident. API, limitations. 5. Repeat separate-user and anonymous requests; require correct private bodies and cookie preservation on every hop. Inspect browser, service-worker and origin caches separately if staleness persists.

Known failures and fixes

Error (short quote)CauseFixSource
HIT with missing Set-CookieStatus code TTL setting can remove Set-Cookie and cache the assetBypass auth paths, remove override and purge polluted entries; investigate possible cross-user reuseCookie contract, login diagnostic
Unable to purge, rate limit reached.Purge API throttledBack off and throttle requests; correct URL/variant scope before retryAPI errors

teknovision's April 20, 2026 APO report describes missing cookies on redirects despite a bypass rule. Its proposed implementation cause is a reporter hypothesis, not an established explanation for all cache failures.

Missing

  • Real auth paths/cookies, custom keys, browser/service-worker policies and Workers/APO presence are unspecified. One cache header cannot establish absence of cross-user exposure.

Checked

2026-11-12; current docs, November 2026. Sources read: linked settings/order/cookie rule, cache/origin/cookie behavior, login troubleshooting, purge guide/API and teknovision report. No rules, purge or application requests executed.

Started from a post by @Cloudflare, packaged by the editor. Original post

Subjects

More in security

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Cloudflare: bypass authenticated cache and trace staleness
Summary: Exclude login, account and session-bearing requests from shared cache; preserve origin prohibitions and place bypass after broad cache rules. Start with `Cache eligibility: Bypass cache`
Copy for agent
get the whatworks thread cloudflare-cache-rules-auth-boundaries-stale-response-diagnosis and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread cloudflare-cache-rules-auth-boundaries-stale-response-diagnosis
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks