Skip to content

Commit e9114c6

Browse files
patriciasantaanasdnts
authored andcommitted
[Challenges] Concepts and Available Types (cloudflare#23085)
* Challenges * implementation * remove faq for now * siteverify * copy edits * clearance * capitalization * accessibility
1 parent 1395ce3 commit e9114c6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+391
-283
lines changed

src/content/docs/cloudflare-challenges/challenge-types/challenge-pages.mdx

Lines changed: 0 additions & 127 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
pcx_content_type: concept
3+
title: Additional configuration
4+
sidebar:
5+
order: 6
6+
---
7+
8+
## Multi-language support
9+
10+
Refer to [supported languages](/cloudflare-challenges/reference/supported-languages/) for more information.
11+
12+
## Favicon customization
13+
14+
Cloudflare Challenges take the favicon of your website using `GET /favicon.ico` and displays it on the Challenge Page.
15+
16+
You can customize your favicon by using the HTML snippet below.
17+
18+
```html title="HTML element"
19+
<link rel="shortcut icon" href="<FAVICON_LINK>" />
20+
```
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
pcx_content_type: concept
3+
title: Challenge Passage
4+
sidebar:
5+
order: 3
6+
---
7+
8+
9+
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.
10+
11+
### How it works
12+
13+
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.
14+
15+
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.
16+
17+
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.
18+
19+
### Customize the Challenge Passage
20+
21+
By default, the `cf_clearance` cookie has a lifetime of 30 minutes. Cloudflare recommends a setting between 15 and 45 minutes.
22+
23+
To update the Challenge Passage (and the value of the `cf_clearance` cookie):
24+
25+
1. Log into the [Cloudflare dashboard](https://dash.cloudflare.com).
26+
2. Select your account and domain.
27+
3. Go to **Security** > **Settings**.
28+
4. For **Challenge Passage**, select a duration.
29+
30+
### Limitations
31+
32+
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.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
pcx_content_type: how-to
3+
title: Implement a Challenge Page via WAF custom rules
4+
sidebar:
5+
order: 2
6+
label: Implementation
7+
---
8+
9+
import { Render } from "~/components"
10+
11+
<Render file="create-challenge-page" />
12+
13+
- **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/).
14+
- **Rate limiting**: You can challenge visitors based on your defined rate limits.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
pcx_content_type: concept
3+
title: Detect a Challenge Page response
4+
sidebar:
5+
order: 4
6+
---
7+
8+
## Detect a Challenge Page response
9+
10+
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.
11+
12+
:::note
13+
Regardless of the requested resource-type, the content-type of a Challenge will be `text/html`.
14+
:::
15+
16+
For the `cf-mitigated` header, `challenge` is the only valid value. The header is set for all Challenge Page types.
17+
18+
To illustrate, here is a JavaScript code snippet that demonstrates how to use the `cf-mitigated` header to detect whether a response was challenged:
19+
20+
```js
21+
fetch("/my-api-endpoint").then((response) => {
22+
if (response.headers.get("cf-mitigated") === "challenge") {
23+
// Handle challenged response
24+
} else {
25+
// Process response as usual
26+
}
27+
});
28+
```
29+
30+
For additional help, refer to our [FAQ](/cloudflare-challenges/frequently-asked-questions/).
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
pcx_content_type: concept
3+
title: Interstitial Challenge Pages
4+
sidebar:
5+
order: 1
6+
---
7+
import { Render } from "~/components"
8+
9+
An interstitial Challenge Page acts as a gate between the visitor and your website or application while Cloudflare verifies the authenticity of the visitor.
10+
11+
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.
12+
13+
<Render file="create-challenge-page" />
14+
15+
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.
16+
17+
## Actions
18+
19+
The following Challenge types are the available actions when you create a WAF rule for a Challenge Page.
20+
21+
### Managed Challenge (recommended)
22+
23+
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.
24+
25+
Most human visitors are automatically verified and the Challenge Page will display **Successful**. However, if Cloudflare detects non-human attributes from the visitor's browser, they may be required to interact with the Challenge to solve it.
26+
27+
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.
28+
29+
:::caution
30+
Using Cloudflare Challenges along with Rules features may cause Challenge loops. Refer to [Rules troubleshooting](/rules/reference/troubleshooting/) for more information.
31+
:::
32+
33+
### Interactive Challenge
34+
35+
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.
36+
37+
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/).
38+
39+
### JavaScript Challenge (non-interactive)
40+
41+
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.
42+
43+
The visitor must wait until their browser finishes processing the JavaScript, which typically takes less than five seconds.
44+
45+
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.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
pcx_content_type: concept
3+
title: Resolve a Challenge
4+
sidebar:
5+
order: 5
6+
---
7+
8+
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.
9+
10+
When observing a Cloudflare Challenge page, a visitor could:
11+
12+
- Successfully pass the Challenge to visit the website.
13+
- Request the website owner to allow their IP address.
14+
- Scan their computer for malicious programs (it may be infected).
15+
- Check their antivirus or firewall service to make sure it is not blocking access to the Challenge resources (for example, images).
16+
17+
:::note
18+
Visitors must enable JavaScript and cookies on their browser to be able to pass any type of Challenge.
19+
:::
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
pcx_content_type: navigation
3-
title: Challenge types
3+
title: Available Challenges
44
sidebar:
55
order: 3
66
group:
@@ -9,6 +9,6 @@ sidebar:
99

1010
import { DirectoryListing } from "~/components"
1111

12-
Refer to the following pages for more information on available challenge types:
12+
Refer to the following pages for more information on available Challenge types:
1313

1414
<DirectoryListing />

src/content/docs/cloudflare-challenges/challenge-types/javascript-detections.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ type: overview
44
pcx_content_type: reference
55
title: JavaScript detections
66
sidebar:
7-
order: 6
7+
order: 3
88
---
99

1010
import { Render } from "~/components"
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
pcx_content_type: concept
3+
title: Turnstile
4+
sidebar:
5+
order: 2
6+
---
7+
8+
import { Render } from "~/components";
9+
10+
[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.
11+
12+
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.
13+
14+
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.
15+
16+
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.
17+
18+
<Render file="siteverify-warning" product="turnstile" />
19+
20+
## Widget types
21+
22+
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.
23+
24+
- **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.
25+
26+
- **Non-Interactive**: The widget is displayed, but the visitor does not need to interact with it to verify their identity.
27+
28+
- **Invisible**: The widget is completely invisible to the visitor, but the Challenge still runs in the background.
29+
30+
## Implementation
31+
32+
When you create a widget for your website or application via the Cloudflare dashboard, you will receive a sitekey.
33+
34+
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.
35+
36+
## Get started
37+
38+
Refer to the [Turnstile documentation](/turnstile/get-started/) for guidance on implementing a widget to your website or application.

0 commit comments

Comments
 (0)