Use the dashboard
Create and deploy custom rulesets in Account Home > WAF > Custom rulesets.
-
Log in to the Cloudflare dashboard ↗ and select your account.
-
Go to Account Home > WAF > Custom rulesets.
-
To create a new empty ruleset, select Create ruleset. To duplicate an existing ruleset, select the three dots next to it > Duplicate.
-
In the page that displays, enter a name and (optionally) a description for the custom ruleset.
-
Under Scope, define when the custom ruleset should run.
- Select All incoming requests to apply the custom ruleset to all incoming requests for all your zones on an Enterprise plan.
- Select Custom filter expression to define a custom expression that defines when to execute the custom ruleset. Use the Field drop-down list to choose an HTTP property. For each request, the value of the property you choose for Field is compared to the value you specify for Value using the operator selected in Operator. Alternatively, select Edit expression to define your expression using the Expression Editor.
-
To create a new rule, select Add rule.
-
Enter a descriptive name for the rule in Rule name.
-
Under When incoming requests match, use the Field drop-down list to choose an HTTP property. For each request, the value of the property you choose for Field is compared to the value you specify for Value using the operator selected in Operator. Alternatively, select Edit expression to define your expression using the Expression Editor.
-
Select the rule action from the Choose action drop-down list. For example, selecting Block tells Cloudflare to refuse requests that match the conditions you specified.
-
(Optional) If you selected the Block action, you can configure a custom response.
-
Select Deploy.
-
Add other rules to the custom ruleset, if needed. You can also duplicate an existing rule in the custom ruleset.
-
Select Create.