Challenge Pages, Clearance Cookies, Passage, and Troubleshooting
How Cloudflare Challenges verify visitors, issue cf_clearance cookies, set Challenge Passage, and what to fix when solves fail or rules loop.
This page summarizes Cloudflare Challenges documentation: interstitial checks that confirm a visitor is human, the cf_clearance cookie that remembers a successful solve, and how WAF rules, bot products, and site policies interact so challenges work without breaking logins or APIs.
Challenges: what they are and when they appear
Section titled “Challenges: what they are and when they appear”Challenges are security mechanisms Cloudflare uses to verify whether a visitor is a real human and not a bot or automated script.
Challenges are security mechanisms used by Cloudflare to verify whether a visitor to your site is a real human and not a bot or automated script.
— Cloudflare, Challenges
When a challenge is issued, the browser runs client-side checks or may need minimal interaction (for example checking a box). Most legitimate visitors pass without interaction. Cloudflare states it does not use visual CAPTCHA puzzles; challenge types are described as lightweight and privacy-preserving. You typically see them when WAF custom rules, rate limiting, IP Access rules, Bot Fight Mode, Under Attack mode, or HTTP DDoS protection flag traffic—see How Challenges work for the product-to-mechanism mapping.
| Product / feature | Typical challenge mechanism |
|---|---|
| WAF (custom, rate limiting, IP access) | Interstitial Challenge Page |
| Bot Fight Mode, Super Bot Fight Mode | Interstitial Challenge Page |
| Bot Management | JavaScript Detections (optional) |
| Turnstile | Embedded widget |
| Under Attack mode | Managed Challenge |
| HTTP DDoS protection | Any challenge type |
Challenge Pages and Turnstile share the same underlying Challenge Platform technology noted in Challenge solve issues.
Interstitial Challenge Pages: Non-Interactive, Managed, and Interactive
Section titled “Interstitial Challenge Pages: Non-Interactive, Managed, and Interactive”An interstitial Challenge Page is a full-page gate before the destination URL; the visitor cannot reach the target without passing.
An interstitial Challenge Page (a full-page screen that appears before the visitor reaches the destination URL) acts as a gate between the visitor and your website or application while Cloudflare verifies the authenticity of the visitor.
— Cloudflare, Interstitial Challenge Pages
You add them with a WAF custom rule; see Implement a Challenge Page via WAF custom rules.
Non-Interactive Challenge: wait for browser JavaScript only
Section titled “Non-Interactive Challenge: wait for browser JavaScript only”With a Non-Interactive Challenge, Cloudflare decides automation from browser signals via injected JavaScript; the visitor waits (typically under five seconds) with no click required. Failure may show another interstitial page (Interstitial Challenge Pages — Non-Interactive).
Managed Challenge: recommended default for WAF rules
Section titled “Managed Challenge: recommended default for WAF rules”Managed Challenges dynamically pick challenge behavior from request signals. Most humans are auto-verified and see “Successful”; others may need a small interaction.
Cloudflare recommends Managed Challenges for most WAF rules. Unless there are specific compatibility issues, do not use other challenge types.
— Cloudflare, Interstitial Challenge Pages
Interactive Challenge: explicit user action
Section titled “Interactive Challenge: explicit user action”Interactive Challenge Pages require deliberate interaction. Cloudflare still recommends Managed Challenge for most cases (Interstitial Challenge Pages — Interactive).
Challenge Pages on AJAX, fetch, and APIs
Section titled “Challenge Pages on AJAX, fetch, and APIs”Challenge Pages return full text/html, which breaks callers expecting JSON or other non-HTML bodies. For API protection without interrupting SPAs, Cloudflare recommends Turnstile Pre-clearance so an HTML page can issue cf_clearance before sensitive endpoints are called; configure hostnames per Pre-clearance configuration.
WAF challenge actions: pass, block, and rule ordering
Section titled “WAF challenge actions: pass, block, and rule ordering”When a firewall rule uses Non-Interactive, Managed, or Interactive Challenge, a failed solve blocks the request; a successful solve allows it and stops further firewall rule processing.
In this last case, no further firewall rules will be processed. This means that the action of any later rules with a challenge or Block action also matching the request will not be applied, and the request will be allowed.
— Cloudflare, Firewall rules actions
Plan rule order so an early challenge match does not skip later blocks you still need.
cf_clearance clearance: challenge clearance vs session (Precursor)
Section titled “cf_clearance clearance: challenge clearance vs session (Precursor)”The cf_clearance cookie proves the visitor passed client-side verification.
A cf_clearance cookie proves to Cloudflare that the visitor is a verified human and has passed Cloudflare’s client-side verifications.
— Cloudflare, Clearance
It combines challenge clearance (after solving a challenge) and precursor clearance (updated from session behavior when Precursor runs in Armed mode). The cookie is tied to the visitor and device and is not meant for reuse across machines (Clearance — cf clearance cookies).
Clearance levels and what they bypass
Section titled “Clearance levels and what they bypass”| Clearance level | Bypasses |
|---|---|
| Interactive (high) | Interactive, Managed, Non-Interactive |
| Managed (medium) | Managed, Non-Interactive |
| Non-Interactive (low) | Non-Interactive only |
A higher level bypasses lower-level challenges for as long as clearance stays valid; a lower level does not spare a later higher-level challenge—the new solve replaces the old clearance (Clearance — Challenge clearance). Turnstile-issued cookies respect zone Challenge Passage duration (Clearance — Clearance cookie duration).
In Armed mode, Precursor can reduce or invalidate effective clearance and re-challenge even before the cookie expires; in Monitor mode it does not change challenge clearance (Clearance — Precursor clearance).
Cookie attributes, HTTPS, and CHIPS
Section titled “Cookie attributes, HTTPS, and CHIPS”cf_clearance uses SameSite=None; Secure; Partitioned for cross-site requests and CHIPS compliance; JavaScript Detections state is stored in this cookie (Cloudflare Cookies — cf clearance cookie for Cloudflare bot products). Sites on HTTP may see SameSite=Lax behavior and broken flows—Cloudflare recommends full HTTPS (SameSite cookie interaction with Cloudflare). Partitioning means clearance from one top-level site is not shared when the same property is embedded elsewhere (SameSite — Impact on embedded challenges).
Challenge Passage: how long solves are remembered
Section titled “Challenge Passage: how long solves are remembered”Challenge Passage controls how long a visitor who solved a challenge is not challenged again on later requests.
When a visitor successfully solves a challenge, Cloudflare sets a cf_clearance cookie in their browser. This cookie specifies the duration your website is accessible to that visitor.
— Cloudflare, Challenge Passage
Default lifetime is 30 minutes; Cloudflare recommends 15–45 minutes. Evaluation adds a few minutes for clock skew, and XmlHTTP requests get an extra hour on short lifetimes (Challenge Passage — How it works). Change it under Security > Settings > Challenge passage (Challenge Passage — Customize). User Agent Blocking rules that challenge also honor this duration (User Agent Blocking).
Challenge solve rate (CSR): reading rule false positives
Section titled “Challenge solve rate (CSR): reading rule false positives”CSR is the percentage of issued challenges (Non-Interactive, Managed, or Interactive) that were solved.
CSR = number of challenges solved / number of challenges issued
— Cloudflare, Challenge solve rate (CSR)
A high CSR suggests many real users were challenged—your rule may be too broad. Failed challenges are not a separate analytics metric; failures are inferred as issued minus solved, and most “failures” are bots abandoning the script (Challenge solve rate — Failed Challenges). A Challenge Solved event in Security Events can appear even when the solved request no longer matches the original rule (for example bot score changed) (Challenge solve rate — Challenge actions in Security Events).
Content Security Policy, Transform Rules, and custom challenge pages
Section titled “Content Security Policy, Transform Rules, and custom challenge pages”Challenge pages require Cloudflare scripts under /cdn-cgi/challenge-platform/. Custom CSP or Referer-Policy via <meta> tags or Transform Rules can break challenges.
If you have a Transform Rule that modifies HTTP response headers across your website (for example, adding custom CSP headers), the rule will interfere with challenge pages and cause them to fail.
— Cloudflare, Additional configuration
Exclude challenge responses at the start of the Transform Rule expression:
not cf.response.error_type in {"managed_challenge" "iuam" "legacy_challenge" "country_challenge"}(Additional configuration — Custom CSP)
For JavaScript Detections, allow /cdn-cgi/challenge-platform/ and script-src 'self'; CSP nonces in response headers are parsed and applied to injected scripts—unsafe-inline is discouraged. Nonces only in <meta> tags are not supported (JavaScript Detections — CSP). Bot Fight Mode enables JSD automatically and cannot disable it (Bot Fight Mode).
Custom Challenge Page HTML requirements
Section titled “Custom Challenge Page HTML requirements”Custom templates must include exactly one ::CF_WIDGET_BOX:: in the body (injection point), a <head> tag, and must not block /cdn-cgi/challenge-platform/ in CSP. Do not define your own window._cf_chl_opt; Cloudflare sets cTplC: 1 when a custom template is active (Additional configuration — Requirements). Favicon on the challenge page comes from GET /favicon.ico unless you add <link rel="shortcut icon" href="<FAVICON_LINK>" /> (Additional configuration — Favicon).
WAF rules and /cdn-cgi/challenge-platform/ loops
Section titled “WAF rules and /cdn-cgi/challenge-platform/ loops”If a challenge rule also matches challenge-platform URLs, you can loop. Exclude those paths:
<OTHER_RULE_CONDITIONS> and not starts_with(http.request.uri, "/cdn-cgi/challenge-platform/")JavaScript Detections and Precursor alongside Challenge Pages
Section titled “JavaScript Detections and Precursor alongside Challenge Pages”JavaScript Detections (JSD) injects invisible script on HTML responses (not typical AJAX-only calls), issues or updates cf_clearance, and exposes cf.bot_management.js_detection.passed. Enforcement requires a WAF rule using that field—false alone does not block (JavaScript Detections). Never match a visitor’s first HTML request with that field; injection needs a prior HTML response (JavaScript Detections — first request).
Precursor is continuous session verification; in Armed mode it can change bot score and clearance, superseding JSD on the same traffic (Precursor — Relationship to JavaScript Detections). Monitor mode collects signals without affecting score or clearance (Precursor adds Monitor mode).
Browser Integrity Check (BIC) challenges missing or non-standard User-Agent values and is on by default; disable globally under Security Settings or selectively with skip rules (Browser Integrity Check).
Detecting challenge responses in application code
Section titled “Detecting challenge responses in application code”Challenge Page responses include cf-mitigated: challenge regardless of challenge type; content-type is text/html.
fetch("/my-api-endpoint").then((response) => { if (response.headers.get("cf-mitigated") === "challenge") { // Handle challenged response } else { // Process response as usual }});(Detect a Challenge Page response)
Troubleshooting: PAT 401, login loops, and known limitations
Section titled “Troubleshooting: PAT 401, login loops, and known limitations”Private Access Token (PAT) HTTP 401 in devtools
Section titled “Private Access Token (PAT) HTTP 401 in devtools”Browsers may request /cdn-cgi/challenge-platform/.../pat/...; unsupported environments return 401, which is expected—not a block or misconfiguration.
This 401 is expected and does not mean the visitor is blocked.
— Cloudflare, Private Access Tokens (PAT)
The same guidance appears in Challenge solve issues.
Login, checkout, and form POST flows
Section titled “Login, checkout, and form POST flows”Challenges on GET can drop session/CSRF context; challenges on POST can break form submission after a solve (Dynamic content and login issues). Fix by narrowing rules, excluding /login, /checkout, or /api/auth/* when appropriate, or using less disruptive controls on first load (Dynamic content and login issues — Resolution).
Platform limitations
Section titled “Platform limitations”Challenges do not support cross-origin iframe embedding, cross-domain challenge pages, UA/Web API tampering extensions, or solving from a different IP than the one that received the challenge (How Challenges work — Limitations). Visitors need JavaScript and cookies enabled (Resolve a Challenge). Extensions, WebViews, and VPNs can interfere—see Supported browsers.
Common mistakes
Section titled “Common mistakes”- Applying site-wide CSP Transform Rules without excluding
managed_challenge,iuam,legacy_challenge, andcountry_challengeresponse types. - Challenging API routes that expect JSON while only Challenge Pages are configured—use Turnstile Pre-clearance or path-specific rules.
- Using
cf.bot_management.js_detection.passedon the first page view or on WebSocket traffic (JavaScript Detections — Enforce). - Matching
/cdn-cgi/*in security rules, including challenge-platform paths. - Serving HTML with
Cache-Control: no-transform, which disables JSD injection (JavaScript Detections — no-transform).
How to check this on your site
Section titled “How to check this on your site”-
Trigger a rule that issues a Managed Challenge from a normal browser; confirm you receive clearance and can load the origin without repeated interstitials for the Challenge Passage window you configured.
-
In Security > Security rules, open the challenging rule and review Challenge solve rate (CSR); if CSR is high, tighten the rule expression per Challenge solve rate (CSR).
-
With devtools open, load a Challenge Page and confirm a
401on a/cdn-cgi/challenge-platform/.../pat/...request still allows completion, per Private Access Tokens (PAT). -
For
fetchor XHR to protected APIs, verify responses: either nocf-mitigated: challengeheader or validcf_clearancewithcredentials: "include"when interstitials apply (Detect a Challenge Page response, Precursor — Use Precursor with APIs). -
You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact wording you are asking about, and we will correct or clarify it.