Skip to content

Commit f4be667

Browse files
authored
[Ruleset Engine] Doc improvements based on assessment (#25958)
1 parent 19df169 commit f4be667

File tree

15 files changed

+139
-84
lines changed

15 files changed

+139
-84
lines changed

src/content/docs/cache/how-to/cache-rules/create-api.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ head:
1212

1313
import { Details, APIRequest } from "~/components"
1414

15-
Use the [Rulesets API](https://developers.cloudflare.com/ruleset-engine/rulesets-api/) to create a cache rule via API. To configure Cloudflare’s API refer to the [API documentation](/fundamentals/api/get-started/).
15+
Use the [Rulesets API](/ruleset-engine/rulesets-api/) to create a cache rule via API. To configure Cloudflare’s API refer to the [API documentation](/fundamentals/api/get-started/).
1616

1717
## Basic rule settings
1818

src/content/docs/ruleset-engine/about/phases.mdx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,16 @@ title: Phases
33
pcx_content_type: concept
44
sidebar:
55
order: 2
6-
76
---
87

9-
A phase defines a stage in the life of a request where you can execute rulesets. Phases are defined by Cloudflare and cannot be modified.
8+
A phase defines a stage in the life of a request where you can execute [rulesets](/ruleset-engine/about/rulesets/). Phases are defined by Cloudflare and cannot be modified.
109

11-
Phases exist at two levels: at the **account** level and at the **zone** level. For the same phase, rules defined at the account level are evaluated **before** the rules defined at the zone level.
10+
Phases exist at two levels: at the account level and at the zone level. For the same phase, rules defined at the account level are evaluated before the rules defined at the zone level.
1211

1312
Each phase has at most one [entry point ruleset](/ruleset-engine/about/rulesets/#entry-point-ruleset) at the account and zone level.
1413

1514
:::note
16-
17-
1815
Currently, phases at the account level are only available in Enterprise plans.
19-
20-
2116
:::
2217

2318
The following diagram outlines the request handling process where requests go through the available phases:

src/content/docs/ruleset-engine/about/rulesets.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Specific Cloudflare products may provide other types of rulesets.
1919

2020
## Entry point ruleset
2121

22-
An entry point ruleset contains a list of ordered rules that run in a [phase](/ruleset-engine/about/phases/) at the account or zone level. This ruleset is an entry point for all rules executed in a phase. Some of these rules may run other rulesets.
22+
An entry point ruleset contains a list of ordered [rules](/ruleset-engine/about/rules/) that run in a [phase](/ruleset-engine/about/phases/) at the account or zone level. This ruleset is an entry point for all rules executed in a phase. Some of these rules may run other rulesets.
2323

2424
Each phase has at most one entry point ruleset at the account level and at the zone level.
2525

src/content/docs/ruleset-engine/basic-operations/add-rule-phase-rulesets.mdx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ If you are adding a **single** rule to a ruleset, consider using one of the [rul
1818
Instead of relying on the automatic creation of an entry point ruleset, you can also create this ruleset explicitly using one of the [ruleset creation operations](/ruleset-engine/rulesets-api/create/).
1919
:::
2020

21-
<Details header="Example: Set the rules of a phase entry point ruleset at the zone level">
21+
## Example: Set the rules of a phase entry point ruleset at the zone level
2222

2323
The following example sets the rules of a phase entry point ruleset at the zone level for the `http_request_firewall_managed` phase using the [Update a zone entry point ruleset](/api/resources/rulesets/subresources/phases/methods/update/) operation.
2424

@@ -87,9 +87,7 @@ The following example sets the rules of a phase entry point ruleset at the zone
8787
}
8888
```
8989

90-
</Details>
91-
92-
<Details header="Example: Add a single rule to a phase entry point ruleset at the zone level">
90+
## Example: Add a single rule to a phase entry point ruleset at the zone level
9391

9492
The following example adds a single rule to a phase entry point ruleset (with ID `$RULESET_ID`) at the zone level using the [Create a zone ruleset rule](/api/resources/rulesets/subresources/rules/methods/create/) operation.
9593

@@ -143,5 +141,3 @@ The following example adds a single rule to a phase entry point ruleset (with ID
143141
"messages": []
144142
}
145143
```
146-
147-
</Details>

src/content/docs/ruleset-engine/basic-operations/deploy-rulesets.mdx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,25 @@ sidebar:
66
order: 4
77
---
88

9-
import { APIRequest } from "~/components";
9+
import { APIRequest, RuleID } from "~/components";
1010

1111
Use the [Rulesets API](/ruleset-engine/rulesets-api/) to deploy a ruleset. To deploy a ruleset, add a rule with `"action": "execute"` to a [phase entry point ruleset](/ruleset-engine/about/rulesets/#entry-point-ruleset), specifying the ruleset ID to execute as an action parameter. Use a separate rule for each ruleset you want to deploy.
1212

1313
A rule that executes a ruleset consists of:
1414

15-
- The **ID of the ruleset** you want to execute.
16-
- An **expression**.
17-
- An **action**, set to `execute`.
15+
- The ID of the ruleset you want to execute, included in `action_parameters.id`.
16+
- An expression.
17+
- The `execute` action.
1818

1919
The rules in the ruleset execute when a request satisfies the expression.
2020

2121
:::note
22-
To apply a rule to every request in a phase at the **zone** level, set the rule expression to `true`.
22+
To apply a rule to every request in a phase at the zone level, set the rule expression to `true`.
2323
:::
2424

2525
## Example
2626

27-
The following example deploys a [managed ruleset](/ruleset-engine/about/rulesets/#managed-rulesets) to the `http_request_firewall_managed` phase of a given zone (`$ZONE_ID`) by adding a rule that executes the managed ruleset.
27+
The following example deploys the [Cloudflare Managed Ruleset](/waf/managed-rules/reference/cloudflare-managed-ruleset/) (with ID <RuleID id="efb7b8c949ac4650a09736fc376e9aee" />) to the `http_request_firewall_managed` phase of a given zone (`$ZONE_ID`) by adding a rule that executes the managed ruleset.
2828

2929
<APIRequest
3030
path="/zones/{zone_id}/rulesets/phases/{ruleset_phase}/entrypoint"
@@ -37,7 +37,7 @@ The following example deploys a [managed ruleset](/ruleset-engine/about/rulesets
3737
{
3838
action: "execute",
3939
action_parameters: {
40-
id: "<CLOUDFLARE_MANAGED_RULESET_ID>",
40+
id: "efb7b8c949ac4650a09736fc376e9aee",
4141
},
4242
expression: "true",
4343
description: "Execute Cloudflare Managed Ruleset on my zone ruleset",
@@ -60,7 +60,7 @@ The following example deploys a [managed ruleset](/ruleset-engine/about/rulesets
6060
"version": "1",
6161
"action": "execute",
6262
"action_parameters": {
63-
"id": "<CLOUDFLARE_MANAGED_RULESET_ID>",
63+
"id": "efb7b8c949ac4650a09736fc376e9aee",
6464
"version": "3"
6565
},
6666
"expression": "true",
@@ -79,6 +79,10 @@ The following example deploys a [managed ruleset](/ruleset-engine/about/rulesets
7979
}
8080
```
8181

82+
:::caution
83+
This API request replaces any existing rules in the `http_request_firewall_managed` phase entry point ruleset with a single rule.
84+
:::
85+
8286
## Related resources
8387

8488
For more examples of deploying rulesets, refer to the following pages:

src/content/docs/ruleset-engine/basic-operations/view-rulesets.mdx

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import { Details, APIRequest } from "~/components";
1010

1111
## View available rulesets
1212

13-
You can list the available rulesets for a zone, account, or phase.
13+
You can list the available rulesets for a zone or account.
1414

15-
<Details header="Example: View available rulesets at the zone level">
15+
### Example: View available rulesets at the zone level
1616

1717
The response to the `GET` request will include the following rulesets:
1818

@@ -22,7 +22,7 @@ The response to the `GET` request will include the following rulesets:
2222

2323
<APIRequest path="/zones/{zone_id}/rulesets" method="GET" />
2424

25-
```json output
25+
```json output collapse={12-29}
2626
{
2727
"result": [
2828
{
@@ -59,9 +59,7 @@ The response to the `GET` request will include the following rulesets:
5959
}
6060
```
6161

62-
</Details>
63-
64-
<Details header="Example: View available rulesets at the account level">
62+
### Example: View available rulesets at the account level
6563

6664
The response will include the following rulesets:
6765

@@ -71,7 +69,7 @@ The response will include the following rulesets:
7169

7270
<APIRequest path="/accounts/{account_id}/rulesets" method="GET" />
7371

74-
```json output
72+
```json output collapse={12-38}
7573
{
7674
"result": [
7775
{
@@ -117,13 +115,11 @@ The response will include the following rulesets:
117115
}
118116
```
119117

120-
</Details>
121-
122118
## View the rules included in a ruleset
123119

124120
You can view all versions of phase entry points (at the account and zone levels) and custom rulesets, but you can only view the most recent version of managed rulesets.
125121

126-
<Details header="Example: View rules in a phase entry point ruleset at the zone level">
122+
### Example: View rules in a phase entry point ruleset at the zone level
127123

128124
The following example lists the rules in version `2` of the `http_request_firewall_managed` phase entry point ruleset at the zone level.
129125

@@ -165,9 +161,7 @@ The following example lists the rules in version `2` of the `http_request_firewa
165161
}
166162
```
167163

168-
</Details>
169-
170-
<Details header="Example: View rules in a managed ruleset">
164+
### Example: View rules in a managed ruleset
171165

172166
The following example lists the rules in version `2` of a managed ruleset (the most recent version of that ruleset).
173167

@@ -182,7 +176,7 @@ Each rule in a managed ruleset can have associated tags or categories, listed in
182176
}}
183177
/>
184178

185-
```json output
179+
```json output collapse={26-36}
186180
{
187181
"result": {
188182
"id": "<MANAGED_RULESET_ID>",
@@ -229,8 +223,6 @@ Each rule in a managed ruleset can have associated tags or categories, listed in
229223
}
230224
```
231225

232-
</Details>
233-
234226
## Related resources
235227

236228
For more information on the available API methods for viewing rulesets, refer to [List and view rulesets](/ruleset-engine/rulesets-api/view/).

src/content/docs/ruleset-engine/managed-rulesets/override-examples/deploy-cmr-wordpress-block.mdx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ head:
88
content: Use tag overrides to set WordPress rules to Block
99
---
1010

11-
import { Details, APIRequest } from "~/components";
11+
import { Details, APIRequest, Render } from "~/components";
1212

1313
Follow the steps below to create a rule that executes a managed ruleset and defines an override for rules with a specific tag.
1414

1515
1. [Add a rule](/ruleset-engine/basic-operations/deploy-rulesets/) to a phase entry point ruleset that executes a managed ruleset.
1616
2. [Configure a tag override](/ruleset-engine/managed-rulesets/override-managed-ruleset/) that sets a specified action for all rules with a given tag.
1717

18-
The example below uses the [Update a zone entry point ruleset](/ruleset-engine/rulesets-api/update/) operation to perform the two steps in a single `PUT` request.
18+
## Zone-level example
19+
20+
This example uses the [Update a zone entry point ruleset](/ruleset-engine/rulesets-api/update/) operation to perform the following two steps in a single `PUT` request:
1921

2022
- Set the list of rules in the `http_request_firewall_managed` phase entry point ruleset to a single rule that executes the [Cloudflare Managed Ruleset](/waf/managed-rules/reference/cloudflare-managed-ruleset/).
2123
- Override rules with the `wordpress` tag to set the action to `block`. All other rules use the default action provided by the ruleset issuer.
2224

23-
<Details header="Example: Use tag overrides to set WordPress rules to Block at the zone level">
24-
2525
<APIRequest
2626
path="/zones/{zone_id}/rulesets/phases/{ruleset_phase}/entrypoint"
2727
method="PUT"
@@ -49,9 +49,14 @@ The example below uses the [Update a zone entry point ruleset](/ruleset-engine/r
4949
}}
5050
/>
5151

52-
</Details>
52+
## Account-level example
53+
54+
This example uses the [Update an account entry point ruleset](/ruleset-engine/rulesets-api/update/) operation to perform the following two steps in a single `PUT` request:
5355

54-
<Details header="Example: Use tag overrides to set WordPress rules to Block at the account level">
56+
- Set the list of rules in the `http_request_firewall_managed` phase entry point ruleset to a single rule that executes the [Cloudflare Managed Ruleset](/waf/managed-rules/reference/cloudflare-managed-ruleset/) for the zone `example.com`.
57+
- Override rules with the `wordpress` tag to set the action to `block`. All other rules use the default action provided by the ruleset issuer.
58+
59+
<Render file="deploy-account-ruleset-requirement" product="ruleset-engine" />
5560

5661
<APIRequest
5762
path="/accounts/{account_id}/rulesets/phases/{ruleset_phase}/entrypoint"
@@ -79,5 +84,3 @@ The example below uses the [Update a zone entry point ruleset](/ruleset-engine/r
7984
],
8085
}}
8186
/>
82-
83-
</Details>

src/content/docs/ruleset-engine/managed-rulesets/override-examples/enable-selected-rules.mdx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ head:
88
content: Use rulesets and rule overrides to only enable selected rules
99
---
1010

11-
import { Details, APIRequest } from "~/components";
11+
import { Details, APIRequest, Render } from "~/components";
1212

1313
Use a ruleset override and a rule override in a phase entry point ruleset to execute only selected rules in a managed ruleset.
1414

1515
1. [Add a rule](/ruleset-engine/basic-operations/deploy-rulesets/) to a phase entry point ruleset that executes a managed ruleset.
1616
2. [Configure a ruleset override](/ruleset-engine/managed-rulesets/override-managed-ruleset/) that disables all rules in the managed ruleset.
1717
3. [Configure a rule override](/ruleset-engine/managed-rulesets/override-managed-ruleset/) to set an action for the rules you want to execute.
1818

19-
<Details header="Example: Configure ruleset and rule overrides at the zone level">
19+
## Zone-level example
2020

2121
The following `PUT` request uses the [Update a zone entry point ruleset](/ruleset-engine/rulesets-api/update/) operation to define a configuration that executes only two rules from a managed ruleset in the `http_request_firewall_managed` phase.
2222

@@ -60,9 +60,7 @@ In this example:
6060
}}
6161
/>
6262

63-
</Details>
64-
65-
<Details header="Example: Configure ruleset and rule overrides at the account level">
63+
## Account-level example
6664

6765
The following `PUT` request uses the [Update an account entry point ruleset](/ruleset-engine/rulesets-api/update/) operation to define a configuration that executes only two rules from a managed ruleset in the `http_request_firewall_managed` phase.
6866

@@ -72,6 +70,8 @@ In this example:
7270
- `"enabled": false` defines an override at the ruleset level to disable all rules in the managed ruleset.
7371
- `"rules": [{"id": "<RULE_ID_1>", "action": "block", "enabled": true}, {"id": "<RULE_ID_2>", "action": "log", "enabled": true}]` defines a list of overrides at the rule level to enable two individual rules.
7472

73+
<Render file="deploy-account-ruleset-requirement" product="ruleset-engine" />
74+
7575
<APIRequest
7676
path="/accounts/{account_id}/rulesets/phases/{ruleset_phase}/entrypoint"
7777
method="PUT"
@@ -105,5 +105,3 @@ In this example:
105105
],
106106
}}
107107
/>
108-
109-
</Details>

src/content/docs/ruleset-engine/managed-rulesets/override-examples/override-ddos-rule-sensitivity.mdx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ Follow the steps below to override the sensitivity of a specific rule of the Clo
1212
1. [Add a rule](/ruleset-engine/basic-operations/deploy-rulesets/) to a phase to deploy the Cloudflare HTTP DDoS Attack Protection managed ruleset. You only need to deploy this specific ruleset when you wish to define one or more overrides, since it is enabled by default.
1313
2. [Configure a rule override](/ruleset-engine/managed-rulesets/override-managed-ruleset/) that sets the `sensitivity_level` of a specific rule.
1414

15+
## Example
16+
1517
The following example uses the [Update a zone entry point ruleset](/ruleset-engine/rulesets-api/update/) operation to execute the two steps in a single `PUT` request.
1618

1719
- Set the rules in the `ddos_l7` phase entry point ruleset to a single rule that executes the Cloudflare HTTP DDoS Attack Protection managed ruleset (with ID `<HTTP_DDOS_RULESET_ID>`).
1820
- Create an override for the rule with ID `<RULE_ID>` and set the rule sensitivity to `low`. All other rules use the default sensitivity defined by Cloudflare.
1921

20-
<Details header="Example: Use an override to set the sensitivity of an HTTP DDoS rule at the zone level">
21-
2222
<APIRequest
2323
path="/zones/{zone_id}/rulesets/phases/{ruleset_phase}/entrypoint"
2424
method="PUT"
@@ -45,5 +45,3 @@ The following example uses the [Update a zone entry point ruleset](/ruleset-engi
4545
],
4646
}}
4747
/>
48-
49-
</Details>

src/content/docs/ruleset-engine/managed-rulesets/override-examples/override-ruleset-tag-rule.mdx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sidebar:
55
order: 5
66
---
77

8-
import { Details, APIRequest } from "~/components";
8+
import { Details, APIRequest, Render } from "~/components";
99

1010
Customize the execution of managed rulesets with a combination of ruleset overrides, tag overrides, and rule overrides in your phase entry point ruleset.
1111

@@ -14,14 +14,14 @@ Customize the execution of managed rulesets with a combination of ruleset overri
1414
3. [Configure a tag override](/ruleset-engine/managed-rulesets/override-managed-ruleset/) that sets an action for rules with a given tag.
1515
4. [Configure a rule override](/ruleset-engine/managed-rulesets/override-managed-ruleset/) that sets an action for the rules you want to execute.
1616

17-
The request below uses the [Update a zone entry point ruleset](/ruleset-engine/rulesets-api/update/) operation to execute the following in a single `PUT` request:
17+
## Zone-level example
18+
19+
This example uses the [Update a zone entry point ruleset](/ruleset-engine/rulesets-api/update/) operation to execute the following in a single `PUT` request:
1820

1921
- Add a rule to the `http_request_firewall_managed` phase entry point ruleset that executes a managed ruleset.
2022
- Use category overrides to enable rules with `wordpress` and `drupal` tags and set their actions to `log`.
2123
- Add a rule override that enables a single rule.
2224

23-
<Details header="Example: Execute a managed ruleset at the zone level with overrides">
24-
2525
In this example:
2626

2727
- `"id": "<MANAGED_RULESET_ID>"` defines the managed ruleset to execute for requests addressed to a zone (`$ZONE_ID`).
@@ -70,9 +70,13 @@ In this example:
7070
}}
7171
/>
7272

73-
</Details>
73+
## Account-level example
7474

75-
<Details header="Example: Execute a managed ruleset at the account level with overrides">
75+
This example uses the [Update an account entry point ruleset](/ruleset-engine/rulesets-api/update/) operation to execute the following in a single `PUT` request:
76+
77+
- Add a rule to the `http_request_firewall_managed` phase entry point ruleset that executes a managed ruleset for the zone `example.com`.
78+
- Use category overrides to enable rules with `wordpress` and `drupal` tags and set their actions to `log`.
79+
- Add a rule override that enables a single rule.
7680

7781
In this example:
7882

@@ -81,6 +85,8 @@ In this example:
8185
- `"categories": [{"category": "wordpress", "action": "log", "enabled": true}, {"category": "drupal", "action": "log", "enabled": true}]` defines an override at the tag level to enable rules tagged with `wordpress` or `drupal` and sets their action to `log`.
8286
- `"rules": [{"id": "<RULE_ID>", "action": "block", "enabled": true}]` defines an override at the rule level that enables one individual rule and sets the action to `block`.
8387

88+
<Render file="deploy-account-ruleset-requirement" product="ruleset-engine" />
89+
8490
<APIRequest
8591
path="/accounts/{account_id}/rulesets/phases/{ruleset_phase}/entrypoint"
8692
method="PUT"
@@ -121,5 +127,3 @@ In this example:
121127
],
122128
}}
123129
/>
124-
125-
</Details>

0 commit comments

Comments
 (0)