Skip to content

Commit 9924ce3

Browse files
patriciasantaanadeadlypants1973
authored andcommitted
[Turnstile] Pre-clearance + Hostname Mgmt overhaul (#19373)
* preclearance cookies * hostname mgmt * fix * get started hostnames * add link * spacing * sme feedback * revert * Update src/content/docs/turnstile/concepts/pre-clearance-support.mdx * remove space
1 parent e8fc5ae commit 9924ce3

File tree

7 files changed

+97
-43
lines changed

7 files changed

+97
-43
lines changed

src/content/docs/turnstile/concepts/hostname-management.mdx

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,61 @@ sidebar:
66

77
---
88

9+
You can associate hostnames with your widget to control where it can be used using Hostname Management. Managing your hostnames ensures that Turnstile works seamlessly with your setup, whether you add standalone hostnames or leverage zones registered to your Cloudflare account.
10+
11+
## Hostname limits
12+
913
By default, all widgets can have up to 10 hostnames associated with a widget. A widget requires at least one hostname to be entered.
1014

1115
Only Enterprise Bot Management and Enterprise Turnstile customers can have this limit increased. Contact your account team to increase your hostname limit.
1216

13-
You must specify a list of hostnames when creating a widget. The widget can only be used on these hostnames and will not work on any other hostnames. You can use subdomains to restrict the widgets further.
17+
## Add a custom hostname
18+
19+
You can add a hostname to your Turnstile widget even if it is not on the Cloudflare network or registered as a zone. There are no prerequisites for using Turnstile.
20+
21+
To add a custom hostname:
22+
23+
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/) and select your account.
24+
2. Go to **Turnstile**.
25+
3. On an existing widget, select **Settings**.
26+
4. Select **Add Hostnames** under Hostname Management.
27+
5. Add a custom hostname or choose from an existing hostname.
28+
6. Select **Add**.
29+
30+
## Add hostnames with a registered zone
31+
32+
If you already have a zone registered with Cloudflare, you can add hostnames during the Turnstile widget setup. You will see all zones registered to your account, where you can select the relevant hostname from the list, and it will be added to your Turnstile widget seamlessly.
33+
34+
## Hostname requirements
35+
36+
When associating hostnames with a widget, follow these requirements:
1437

15-
The hostname should not contain a scheme `http://` or `https://`, a port `443`, or a path `/`.
38+
- Hostnames must be fully qualified domain names (FQDNs), such as `example.com` or `subdomain.example.com`.
39+
- Wildcards are not supported. Specify each hostname you want Turnstile to work on.
40+
- The hostname should not include:
41+
- A scheme (for example, `http://` or `https://`)
42+
- A port (for example, `443`)
43+
- A path (for example, `/path`)
1644

17-
Specifying a subdomain is optional.
45+
### Subdomain specification
1846

19-
For example, using the `www.example.com` value will allow widgets on the following hostnames:
47+
Specifying a subdomain is optional, but it can be used to further restrict the widget. For example, adding `www.example.com` as a hostname will allow widgets to work on:
2048

2149
- `www.example.com`
2250
- `abc.www.example.com:8080`
2351

24-
but not on the following hostnames:
52+
However, it will not work on the following hostnames:
2553

2654
- `example.com`
2755
- `dash.example.com`
2856
- `cloudflare.com`
2957

30-
When the widget is embedded on a hostname not listed, it will show an error message.
58+
:::note
59+
If the widget is embedded on a hostname not listed, it will display an error message.
60+
:::
3161

32-
## Optional hostname validation
62+
## Optional hostname validation (Enterprise only)
3363

34-
Customers with Enterprise Bot Management or Enterprise Turnstile can have the optional `any hostname` validation entitlement.
64+
Customers with Enterprise Bot Management or Enterprise Turnstile can have the optional any hostname validation entitlement.
3565

36-
By default, a widget requires at least one hostname to be entered. With this entitlement, you can create and use a widget without entering any hostnames for the widget. Contact your account team to enable this entitlement.
66+
By default, a widget requires at least one hostname to be entered. With this entitlement, you can create and use a widget without entering any hostnames for the widget. Contact your account team to enable this entitlement.

src/content/docs/turnstile/concepts/pre-clearance-support.mdx

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,36 @@ sidebar:
66

77
---
88

9-
You can integrate Cloudflare challenges on single-page applications (SPAs) by allowing Turnstile to issue a clearance cookie. The clearance level is set upon widget creation or widget modification using the Turnstile API's `clearance_level`. Possible values for the configuration are `no_clearance`, `jschallenge`, `managed`, or `interactive`. All widgets are set to `no_clearance` by default.
9+
Pre-clearance in Turnstile allows websites to streamline user experiences by using clearance cookies. These cookies enable visitors to bypass WAF challenges downstream, based on the security clearance level set by the customer. This can be particularly useful for trusted visitors, enhancing usability while maintaining security.
1010

11-
For Enterprise customers eligible to toggle off domain checks, Cloudflare recommends issuing clearance cookies on widgets where at least one domain is specified.
11+
You can integrate Cloudflare challenges by allowing Turnstile to issue a pre-clearance cookie. The pre-clearance level is set upon widget creation or widget modification using the Turnstile API's `clearance_level`. Possible values for the configuration are:
12+
13+
- `no_clearance`
14+
- `jschallenge`
15+
- `managed`
16+
- `interactive`
17+
18+
All widgets are set to `no_clearance` by default.
19+
20+
For Enterprise customers eligible to toggle off domain checks, Cloudflare recommends issuing pre-clearance cookies on widgets where at least one domain is specified.
1221

1322
:::note
1423

1524
Clearance cookies only support zones that are orange-clouded.
1625
:::
1726

18-
Refer to the [blog post](https://blog.cloudflare.com/integrating-turnstile-with-the-cloudflare-waf-to-challenge-fetch-requests) for an example of pre-clearance implementation.
27+
Refer to the [blog post](https://blog.cloudflare.com/integrating-turnstile-with-the-cloudflare-waf-to-challenge-fetch-requests) for more details on how pre-clearance works with WAF.
1928

2029
## Pre-clearance level options
2130

22-
- **Interactive**: Interactive Pre-clearance allows a user with a clearance cookie to not be challenged by Interactive, Managed Challenge, or JavaScript Challenge Firewall Rules
23-
- **Managed**: Managed allows a user with a clearance cookie to not be challenged by Managed Challenge or JavaScript Challenge Firewall Rules
24-
- **Non-interactive**: Non-interactive allows a user with a clearance cookie to not be challenged by JavaScript Challenge Firewall Rules
31+
- **Interactive (High)**: Allows a user with a clearance cookie to not be challenged by Interactive, Managed Challenge, or JavaScript Challenge Firewall Rules
32+
- **Managed (Medium)**: Allows a user with a clearance cookie to not be challenged by Managed Challenge or JavaScript Challenge Firewall Rules
33+
- **Non-interactive (Low)**: Allows a user with a clearance cookie to not be challenged by JavaScript Challenge Firewall Rules
2534

26-
### Duration
35+
## Clearance cookie duration
2736

2837
Clearance cookies generated by the Turnstile widget will be valid for the time specified by the zone-level Challenge Passage value. To configure the Challenge Passage setting, refer to the [WAF documentation](/waf/tools/challenge-passage/).
2938

30-
## Enable pre-clearance on a new site
31-
32-
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login) and select your account.
33-
2. Go to **Turnstile** > **Add widget**.
34-
3. Under **Would you like to opt for pre-clearance for this site?** select **Yes**.
35-
4. Choose the pre-clearance level from the select box.
36-
5. Select **Create**.
37-
38-
## Enable pre-clearance on an existing site
39-
40-
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login) and select your account.
41-
2. Go to **Turnstile**.
42-
3. Go to the existing widget or site and select **Settings**.
43-
4. Under **Would you like to opt for pre-clearance for this site?** select **Yes**.
44-
5. Choose the pre-clearance level from the select box.
45-
6. Select **Update**.
46-
47-
## Verified bots
48-
49-
If a [verified bot](/bots/concepts/bot/#verified-bots) encounters a page where a Turnstile widget is implemented, the challenge will fail and the verified bot will see a `403` error from the Turnstile endpoint.
39+
## Setup
5040

51-
However, if a verified bot is excluded from the rule which pre-clearance will grant clearance for, it will pass. Users can create a [WAF custom rule](/waf/custom-rules/) to exclude verified bots.
41+
To set up pre-clearance cookies, refer to [Enable pre-clearance cookies](/turnstile/get-started/pre-clearance/).

src/content/docs/turnstile/get-started/index.mdx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ You can find special sitekeys to be used for testing in the [testing](/turnstile
3131

3232
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/?to=/:account/turnstile) and select your account.
3333
2. Go to **Turnstile**.
34-
3. Select **Add widget** and fill out the site name and your website's hostname or select from your existing websites on Cloudflare.
34+
3. Select **Add widget** and fill out the site name and [your website's hostname or select from your existing websites](/turnstile/concepts/hostname-management/) on Cloudflare.
3535
4. Select the widget mode.
3636
5. (Optional) Opt in for [pre-clearance support](/turnstile/concepts/pre-clearance-support/).
3737
6. Copy your sitekey and secret key.
@@ -41,8 +41,9 @@ You can find special sitekeys to be used for testing in the [testing](/turnstile
4141
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/?to=/:account/turnstile) and select your account.
4242
2. Go to **Turnstile**.
4343
3. In the widget overview, select **Settings**.
44-
4. (Optional) Opt in for [pre-clearance support](/turnstile/concepts/pre-clearance-support/).
45-
5. Copy your sitekey and secret key.
44+
4. Confirm the [hostnames](/turnstile/concepts/hostname-management/) configured.
45+
5. (Optional) Opt in for [pre-clearance support](/turnstile/concepts/pre-clearance-support/).
46+
6. Copy your sitekey and secret key.
4647

4748
## Add the Turnstile widget to your site
4849

src/content/docs/turnstile/get-started/mobile-implementation.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Mobile implementation
33
pcx_content_type: concept
44
sidebar:
5-
order: 5
5+
order: 6
66

77
---
88

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
title: Enable pre-clearance cookies
3+
pcx_content_type: get-started
4+
sidebar:
5+
order: 3
6+
label: Pre-clearance cookies
7+
8+
---
9+
10+
## Prerequisites
11+
12+
To enable pre-clearance, you must ensure that the hostname of the Turnstile widget matches the zone with the WAF rules. During the Turnstile configuration setup in the Cloudflare dashboard, you can see the registered zones. Select the appropriate hostname from this list.
13+
14+
The prerequisite is crucial for pre-clearance to function properly. If set up correctly, visitors who successfully solve Turnstile will receive a cookie with the security clearance level set by the customer. When encountering a WAF challenge on the same zone, they will bypass additional challenges for the configured clearance level and below.
15+
16+
For more details on managing hostnames, refer to the [Hostname Management documentation](/turnstile/concepts/hostname-management/).
17+
18+
## Enable pre-clearance on a new site
19+
20+
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login) and select your account.
21+
2. Go to **Turnstile** > **Add widget**.
22+
3. Under **Would you like to opt for pre-clearance for this site?** select **Yes**.
23+
4. Choose the pre-clearance level from the select box.
24+
5. Select **Create**.
25+
26+
## Enable pre-clearance on an existing site
27+
28+
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login) and select your account.
29+
2. Go to **Turnstile**.
30+
3. Go to the existing widget or site and select **Settings**.
31+
4. Under **Would you like to opt for pre-clearance for this site?** select **Yes**.
32+
5. Choose the pre-clearance level from the select box.
33+
6. Select **Update**.

src/content/docs/turnstile/get-started/supported-browsers.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ pcx_content_type: concept
33
title: Supported browsers
44
external_link: /waf/reference/cloudflare-challenges/#browser-support
55
sidebar:
6-
order: 4
6+
order: 5
77

88
---

src/content/docs/turnstile/get-started/terraform.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pcx_content_type: how-to
33
title: Terraform
44
sidebar:
5-
order: 3
5+
order: 4
66
---
77

88
:::note[Requirements]

0 commit comments

Comments
 (0)