-
Notifications
You must be signed in to change notification settings - Fork 10k
[Challenges] Concepts and Available Types #23085
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
patriciasantaana
merged 9 commits into
production
from
patricia/pcx17366-challenge-types
Jun 24, 2025
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
abcfe7d
Challenges
patriciasantaana 827d2bf
Merge branch 'production' into patricia/pcx17366-challenge-types
patriciasantaana e652449
implementation
patriciasantaana 2ecff4b
remove faq for now
patriciasantaana d617465
siteverify
patriciasantaana 93fe763
copy edits
patriciasantaana 399151c
clearance
patriciasantaana 9fd41a2
capitalization
patriciasantaana 50180a2
accessibility
patriciasantaana File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
127 changes: 0 additions & 127 deletions
127
src/content/docs/cloudflare-challenges/challenge-types/challenge-pages.mdx
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
...udflare-challenges/challenge-types/challenge-pages/additional-configuration.mdx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| --- | ||
| pcx_content_type: concept | ||
| title: Additional configuration | ||
| sidebar: | ||
| order: 6 | ||
| --- | ||
|
|
||
| ## Multi-language support | ||
|
|
||
| Refer to [supported languages](/cloudflare-challenges/reference/supported-languages/) for more information. | ||
|
|
||
| ## Favicon customization | ||
|
|
||
| Cloudflare Challenges take the favicon of your website using `GET /favicon.ico` and displays it on the Challenge Page. | ||
|
|
||
| You can customize your favicon by using the HTML snippet below. | ||
|
|
||
| ```html title="HTML element" | ||
| <link rel="shortcut icon" href="<FAVICON_LINK>" /> | ||
| ``` |
32 changes: 32 additions & 0 deletions
32
...ocs/cloudflare-challenges/challenge-types/challenge-pages/challenge-passage.mdx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| --- | ||
| pcx_content_type: concept | ||
| title: Challenge Passage | ||
| sidebar: | ||
| order: 3 | ||
| --- | ||
|
|
||
|
|
||
| When a visitor solves a [Cloudflare Challenge](/cloudflare-challenges/) - as part of a [WAF custom rule](/waf/custom-rules/) or [IP Access rule](/waf/tools/ip-access-rules/) - you can set the **Challenge Passage** to prevent them from having to solve future Challenges for a specified period of time. | ||
|
|
||
| ### How it works | ||
|
|
||
| When a visitor successfully solves a Challenge, Cloudflare sets a [`cf_clearance` cookie](/fundamentals/reference/policies-compliances/cloudflare-cookies/#additional-cookies-used-by-the-challenge-platform) in their browser. This cookie specifies the duration your website is accessible to that visitor. | ||
|
|
||
| When that visitor tries to access other parts of your website, Cloudflare evaluates the cookie before presenting another Challenge. If the cookie is still valid, no Challenges will be shown. | ||
|
|
||
| When Cloudflare evaluates a `cf_clearance` cookie, a few extra minutes are included to account for clock skew. For XmlHTTP requests, an extra hour is added to the validation time to prevent breaking XmlHTTP requests for pages that set short lifetimes. | ||
|
|
||
| ### Customize the Challenge Passage | ||
|
|
||
| By default, the `cf_clearance` cookie has a lifetime of 30 minutes. Cloudflare recommends a setting between 15 and 45 minutes. | ||
|
|
||
| To update the Challenge Passage (and the value of the `cf_clearance` cookie): | ||
|
|
||
| 1. Log into the [Cloudflare dashboard](https://dash.cloudflare.com). | ||
| 2. Select your account and domain. | ||
| 3. Go to **Security** > **Settings**. | ||
| 4. For **Challenge Passage**, select a duration. | ||
|
|
||
| ### Limitations | ||
|
|
||
| The Challenge Passage does not apply to Challenges issued by [WAF managed rules](/waf/managed-rules/). Also, Challenge Passage does not apply to rate limiting rules unless the rate limit is configured to issue a Challenge. |
14 changes: 14 additions & 0 deletions
14
...cs/cloudflare-challenges/challenge-types/challenge-pages/create-custom-rule.mdx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| --- | ||
| pcx_content_type: how-to | ||
| title: Implement a Challenge Page via WAF custom rules | ||
| sidebar: | ||
| order: 2 | ||
| label: Implementation | ||
| --- | ||
|
|
||
| import { Render } from "~/components" | ||
|
|
||
| <Render file="create-challenge-page" /> | ||
|
|
||
| - **Bot Management**: You can set the custom rule to challenge a visitor based on the [bot score](/bots/concepts/bot-score/) or [detection ID](/bots/additional-configurations/detection-ids/). | ||
| - **Rate limiting**: You can challenge visitors based on your defined rate limits. |
30 changes: 30 additions & 0 deletions
30
.../docs/cloudflare-challenges/challenge-types/challenge-pages/detect-response.mdx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| --- | ||
| pcx_content_type: concept | ||
| title: Detect a Challenge Page response | ||
| sidebar: | ||
| order: 4 | ||
| --- | ||
|
|
||
| ## Detect a Challenge Page response | ||
|
|
||
| When a request encounters a Cloudflare Challenge Page instead of the originally anticipated response, the Challenge Page response (regardless of the Challenge Page type) will have the `cf-mitigated` header present and set to `challenge`. This header can be leveraged to detect if a response was challenged when making fetch/XHR requests. This header provides a reliable way to identify whether a response is a Challenge or not, enabling a web application to take appropriate action based on the result. For example, a front-end application encountering a response from the backend may check the presence of this header value to handle cases where Challenge Pages encountered unexpectedly. | ||
|
|
||
| :::note | ||
| Regardless of the requested resource-type, the content-type of a Challenge will be `text/html`. | ||
| ::: | ||
|
|
||
| For the `cf-mitigated` header, `challenge` is the only valid value. The header is set for all Challenge Page types. | ||
|
|
||
| To illustrate, here is a JavaScript code snippet that demonstrates how to use the `cf-mitigated` header to detect whether a response was challenged: | ||
|
|
||
| ```js | ||
| fetch("/my-api-endpoint").then((response) => { | ||
| if (response.headers.get("cf-mitigated") === "challenge") { | ||
| // Handle challenged response | ||
| } else { | ||
| // Process response as usual | ||
| } | ||
| }); | ||
| ``` | ||
|
|
||
| For additional help, refer to our [FAQ](/cloudflare-challenges/frequently-asked-questions/). |
45 changes: 45 additions & 0 deletions
45
src/content/docs/cloudflare-challenges/challenge-types/challenge-pages/index.mdx
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⭐ New content ⭐ |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| --- | ||
| pcx_content_type: concept | ||
| title: Interstitial Challenge Pages | ||
| sidebar: | ||
| order: 1 | ||
| --- | ||
| import { Render } from "~/components" | ||
|
|
||
| An interstitial Challenge Page acts as a gate between the visitor and your website or application while Cloudflare verifies the authenticity of the visitor. | ||
|
|
||
| The Challenge Page intercepts the visitor from getting to the destination URL by holding the request and evaluating the browser environment for automated signals, and serving a Challenge. The visitor cannot reach their destination without passing the Challenge. Based on the signals indicated by their browser environment, the visitor may be asked to perform an interaction such as checking a box or selecting a button for further probing. | ||
|
|
||
| <Render file="create-challenge-page" /> | ||
|
|
||
| The level of interactivity and visibility of the Challenge Page depends on the Action that you select when creating the WAF rule for your website or application. | ||
|
|
||
| ## Actions | ||
|
|
||
| The following Challenge types are the available actions when you create a WAF rule for a Challenge Page. | ||
|
|
||
| ### Managed Challenge (recommended) | ||
|
|
||
| Managed Challenges are where Cloudflare dynamically chooses the appropriate type of Challenge served to the visitor based on the characteristics of a request from the signals indicated by their browser. This helps avoid [CAPTCHAs](https://www.cloudflare.com/learning/bots/how-captchas-work/), which also reduces the lifetimes of human time spent solving CAPTCHAs across the Internet. | ||
|
|
||
| Most human visitors are automatically verified and will see **Successful** on the Challenge Page. However, if Cloudflare detects non-human attributes from the visitor's browser, they may be required to interact with the Challenge to solve it. | ||
patriciasantaana marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
patriciasantaana marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Unless there are specific compatibility issues or other reasons to use other types of Challenges, Cloudflare recommends you to use Managed Challenges for your custom rules. | ||
|
|
||
| :::caution | ||
| Using Cloudflare Challenges along with Rules features may cause Challenge loops. Refer to [Rules troubleshooting](/rules/reference/troubleshooting/) for more information. | ||
| ::: | ||
|
|
||
| ### Interactive Challenge | ||
|
|
||
| Interactive Challenge Pages offer the highest security for your website or application because it requires a visitor to interact with the Interstitial Challenge Page, presenting the visitor with an Interactive Challenge to solve. | ||
|
|
||
| For more information about why Cloudflare does not recommend using Interactive Challenge, in favor of Managed Challenge, refer to our [blog post](https://blog.cloudflare.com/end-cloudflare-captcha/). | ||
|
|
||
| ### JavaScript Challenge (non-interactive) | ||
|
|
||
| With a JavaScript (JS) Challenge, Cloudflare makes the determination on whether or not the visitor is automated based on the limited information attained from their browser signals via an injected JavaScript. Then, it presents a Challenge Page that requires no interaction from a visitor except the JavaScript processed by their browser. | ||
|
|
||
| The visitor must wait until their browser finishes processing the JavaScript, which typically takes less than five seconds. | ||
|
|
||
| If the visitor passes the Challenge, the original request continues to the destination URL. If the Challenge fails or cannot be completed, the visitor is presented with another Interstitial Challenge Page. | ||
19 changes: 19 additions & 0 deletions
19
...ocs/cloudflare-challenges/challenge-types/challenge-pages/resolve-challenge.mdx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| --- | ||
| pcx_content_type: concept | ||
| title: Resolve a Challenge | ||
| sidebar: | ||
| order: 5 | ||
| --- | ||
|
|
||
| If a visitor encounters a Challenge, Cloudflare employees cannot remove that Challenge. Only the website owner can configure their Cloudflare settings to stop the Challenge being presented. | ||
|
|
||
| When observing a Cloudflare Challenge page, a visitor could: | ||
|
|
||
| - Successfully pass the Challenge to visit the website. | ||
| - Request the website owner to allow their IP address. | ||
| - Scan their computer for malicious programs (it may be infected). | ||
| - Check their antivirus or firewall service to make sure it is not blocking access to the Challenge resources (for example, images). | ||
|
|
||
| :::note | ||
| Visitors must enable JavaScript and cookies on their browser to be able to pass any type of Challenge. | ||
| ::: |
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
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
38 changes: 38 additions & 0 deletions
38
src/content/docs/cloudflare-challenges/challenge-types/turnstile.mdx
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⭐ New content ⭐ |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| --- | ||
| pcx_content_type: concept | ||
| title: Turnstile | ||
| sidebar: | ||
| order: 2 | ||
| --- | ||
|
|
||
| import { Render } from "~/components"; | ||
|
|
||
| [Turnstile](/turnstile/) is Cloudflare's CAPTCHA-alternative solution. You can embed Turnstile as a widget on your website or application, where it runs a client-side Challenge directly in the background of the visitor's browser. | ||
|
|
||
| Turnstile differs from Challenges Pages in that the Challenge does not pause the request or interrupt the user's experience. Since the widget is embedded onto the webpage and only runs on a specific part of the HTML, the visitor will have already arrived at the destination URL and is viewing the page when they encounter a Turnstile widget. Instead of blocking the visitor from accessing the entire website, the Turnstile widget prevents the visitor from certain actions such as completing login or sign up forms, and more, until the widget is solved. | ||
|
|
||
| In most cases, nothing further is required from the visitor. However, if necessary, Turnstile may display a simple checkbox that the visitor must click to proceed. | ||
|
|
||
| After the Challenge passes, Turnstile issues a clearance token to the visitor that must be validated via the [Siteverify API](/turnstile/get-started/server-side-validation/) before completing a sensitive action like login, sign up, or other form submissions. | ||
|
|
||
| <Render file="siteverify-warning" product="turnstile" /> | ||
|
|
||
| ## Widget types | ||
|
|
||
| While there are three types of widgets that you can choose to implement on your website or application, the Challenge logic behind them remains the same. | ||
|
|
||
| - **Managed (recommended)**: Functions similar to a Managed Challenge Page. It selects a Challenge based on the signals gathered from the visitor's browser and presents an interaction only if it detects potentially automated traffic. | ||
|
|
||
| - **Non-Interactive**: The visitor can see the widget, but does not need to interact with it to verify their identity. | ||
patriciasantaana marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - **Invisible**: The widget is completely invisible to the visitor, but the Challenge still runs in the background. | ||
|
|
||
| ## Implementation | ||
|
|
||
| When you create a widget for your website or application via the Cloudflare dashboard, you will receive a sitekey. | ||
|
|
||
| The sitekey is used with [client-side rendering](/turnstile/get-started/client-side-rendering/#implicitly-render-the-turnstile-widget) by adding it to the `<div>` container placeholder. You will then place that `<div>` code snippet where you want to add the widget to your site page or form. | ||
|
|
||
| ## Get started | ||
|
|
||
| Refer to the [Turnstile documentation](/turnstile/get-started/) for guidance on implementing a widget to your website or application. | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⭐ New content ⭐