INTEGRITY Cloudflare Docs

Deploy a managed ruleset with ruleset, tag, and rule overrides

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

  1. Add a rule to a phase entry point ruleset to execute a managed ruleset.
  2. Configure a ruleset override that disables all rules in the managed ruleset.
  3. Configure a tag override that sets an action for rules with a given tag.
  4. Configure a rule override that sets an action for the rules you want to execute.

Zone-level example

This example uses the Update a zone entry point ruleset operation to execute the following in a single PUT request:

In this example:

Required API token permissions

At least one of the following token permissions is required:
Update a zone entry point ruleset
curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/rulesets/phases/http_request_firewall_managed/entrypoint" \
	--request PUT \
	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
	--json '{
		"rules": [
				{
						"action": "execute",
						"expression": "true",
						"action_parameters": {
								"id": "<MANAGED_RULESET_ID>",
								"overrides": {
										"enabled": false,
										"categories": [
												{
														"category": "wordpress",
														"action": "log",
														"enabled": true
												},
												{
														"category": "drupal",
														"action": "log",
														"enabled": true
												}
										],
										"rules": [
												{
														"id": "<RULE_ID>",
														"action": "block",
														"enabled": true
												}
										]
								}
						}
				}
		]
	}'

Account-level example

This example uses the Update an account entry point ruleset operation to execute the following in a single PUT request:

In this example:

Required API token permissions

At least one of the following token permissions is required:
Update an account entry point ruleset
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/rulesets/phases/http_request_firewall_managed/entrypoint" \
	--request PUT \
	--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
	--json '{
		"rules": [
				{
						"action": "execute",
						"expression": "cf.zone.name eq \"example.com\" and cf.zone.plan eq \"ENT\"",
						"action_parameters": {
								"id": "<MANAGED_RULESET_ID>",
								"overrides": {
										"enabled": false,
										"categories": [
												{
														"category": "wordpress",
														"action": "log",
														"enabled": true
												},
												{
														"category": "drupal",
														"action": "log",
														"enabled": true
												}
										],
										"rules": [
												{
														"id": "<RULE_ID>",
														"action": "block",
														"enabled": true
												}
										]
								}
						}
				}
		]
	}'