Skip to content

Commit 6335ab5

Browse files
move JSD from Bots to Challenges
1 parent 95b9229 commit 6335ab5

File tree

8 files changed

+52
-55
lines changed

8 files changed

+52
-55
lines changed

public/__redirects

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@
232232
/bots/get-started/free/ /bots/get-started/bot-fight-mode/ 301
233233
/bots/get-started/bm-subscription/ /bots/get-started/bot-management/ 301
234234
/bots/get-started/pro/ /bots/get-started/super-bot-fight-mode/ 301
235+
/bots/additional-configurations/javascript-detections/ /cloudflare-challenges/challenge-types/javascript-detections/ 301
235236

236237
#browser-rendering
237238
/browser-rendering/get-started/browser-rendering-with-do/ /browser-rendering/workers-binding-api/browser-rendering-with-do/ 301
Lines changed: 4 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,7 @@
11
---
2-
type: overview
3-
pcx_content_type: reference
2+
pcx_content_type: concept
43
title: JavaScript detections
4+
external_link: /cloudflare-challenges/challenge-types/javascript-detections/
55
sidebar:
6-
order: 6
7-
---
8-
9-
import { Render } from "~/components"
10-
11-
<Render file="javascript-detections-definition" params={{ one: " " }} />
12-
13-
## Enable JavaScript detections
14-
15-
For Free customers (Bot Fight Mode), JavaScript detections are automatically enabled and cannot be disabled.
16-
17-
For all other customers (Super Bot Fight Mode and Bot Management for Enterprise), JavaScript detections are optional.
18-
19-
<Render file="javascript-detections-enable" />
20-
21-
For more details on how to set up bot protection, see [Get started](/bots/get-started/).
22-
23-
## Enforcing execution of JavaScript detections
24-
25-
<Render file="javascript-detections-implementation" />
26-
27-
<Render file="cf-clearance-cookie" />
28-
29-
## Limitations
30-
31-
### If you enabled Bot Management before June 2020
32-
33-
Customers who enabled Enterprise Bot Management before June 2020 do not have JavaScript detections enabled by default (unless specifically requested). These customers can still enable the feature in the Cloudflare dashboard.
34-
35-
### If you have a Content Security Policy (CSP)
36-
37-
<Render file="javascript-detections-csp" />
38-
39-
:::caution[Warning]
40-
41-
JavaScript detections are not supported with `nonce` set via `<meta>` tags.
42-
:::
43-
44-
### If you have ETags
45-
46-
Enabling JavaScript Detections (JSD) will strip [ETags](/cache/reference/etag-headers/) from HTML responses where JSD is injected.
6+
order: 2
7+
---
Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,47 @@
1+
12
---
2-
pcx_content_type: concept
3+
type: overview
4+
pcx_content_type: reference
35
title: JavaScript detections
4-
external_link: /bots/additional-configurations/javascript-detections/
56
sidebar:
6-
order: 2
7-
---
7+
order: 6
8+
---
9+
10+
import { Render } from "~/components"
11+
12+
<Render file="javascript-detections-definition" />
13+
14+
## Enable JavaScript detections
15+
16+
For Bot Fight Mode customers, JavaScript detections are automatically enabled and cannot be disabled.
17+
18+
For Super Bot Fight Mode and Bot Management for Enterprise customers, JavaScript detections are optional.
19+
20+
<Render file="javascript-detections-enable" />
21+
22+
For more details on how to set up bot protection, refer to the [Bots documentation](/bots/get-started/).
23+
24+
## Enforcing execution of JavaScript detections
25+
26+
<Render file="javascript-detections-implementation" />
27+
28+
<Render file="cf-clearance-cookie" />
29+
30+
## Limitations
31+
32+
### If you enabled Bot Management before June 2020
33+
34+
Customers who enabled Enterprise Bot Management before June 2020 do not have JavaScript detections enabled by default (unless specifically requested). These customers can still enable the feature in the Cloudflare dashboard.
35+
36+
### If you have a Content Security Policy (CSP)
37+
38+
<Render file="javascript-detections-csp" />
39+
40+
:::caution[Warning]
41+
42+
JavaScript detections are not supported with `nonce` set via `<meta>` tags.
43+
:::
44+
45+
### If you have ETags
46+
47+
Enabling JavaScript Detections (JSD) will strip [ETags](/cache/reference/etag-headers/) from HTML responses where JSD is injected.
File renamed without changes.
File renamed without changes.

src/content/partials/bots/javascript-detections-definition.mdx renamed to src/content/partials/cloudflare-challenges/javascript-detections-definition.mdx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
---
2-
inputParameters: param1
3-
2+
{}
43
---
54

65
import { Markdown } from "~/components"
76

87
JavaScript detections are another method that help Cloudflare identify bot requests.
98

10-
{props.one}
11-
12-
## What are JavaScript detections?
13-
149
These detections are implemented via a lightweight, invisible JavaScript code snippet that follows Cloudflare’s [privacy standards](https://www.cloudflare.com/privacypolicy/). JavaScript is injected only in response to requests for HTML pages or page views, excluding AJAX calls. API and mobile app traffic is unaffected. JavaScript detections have a lifespan of 15 minutes. However, the code is injected again before the session expires. After page load, the script is deferred and utilizes a separate thread (where available) to ensure that performance impact is minimal.
1510

1611
The snippets of JavaScript will contain a source pointing to the challenge platform, with paths that start with `/cdn-cgi/challenge-platform/...`
File renamed without changes.

src/content/partials/bots/javascript-detections-implementation.mdx renamed to src/content/partials/cloudflare-challenges/javascript-detections-implementation.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
---
55

6-
Once you enable JavaScript detections, you can use the `cf.bot_management.js_detection.passed` field in WAF custom rules (or the `request.cf.botManagement.jsDetection.passed` variable in Workers).
6+
Once you enable JavaScript detections, you can use the `cf.bot_management.js_detection.passed` field in [WAF custom rules](/waf/custom-rules/) (or the `request.cf.botManagement.jsDetection.passed` variable in [Workers](/workers/)).
77

88
When adding this field to WAF custom rules, use it:
99

@@ -14,7 +14,7 @@ When adding this field to WAF custom rules, use it:
1414
### Prerequisites
1515

1616
* You must have JavaScript detections enabled on your zone.
17-
* You must have [updated your Content Security Policy headers](/bots/additional-configurations/javascript-detections/#if-you-have-a-content-security-policy-csp) for JavaScript detections.
17+
* You must have [updated your Content Security Policy headers](/cloudflare-challenges/challenge-types/javascript-detections/#if-you-have-a-content-security-policy-csp) for JavaScript detections.
1818
* You must not run this field on websocket endpoints.
1919
* You must use the field in a custom rules expression that expects only browser traffic.
2020
* The action should always be a managed challenge in case a legitimate user has not received the challenge for network or browser reasons.

0 commit comments

Comments
 (0)