Override a managed ruleset
Last updated Apr 16, 2026 To customize the behavior of a managed ruleset via API, override the ruleset at deployment. When you override a ruleset you specify changes to be executed on top of the default configuration. These changes take precedence over the ruleset's default behavior.
For example, to test a managed ruleset before enforcing it, consider executing the ruleset with all rules set to log instead of their default actions. To do this, override the configured behavior of the managed ruleset at the ruleset level, so that each rule uses the log action.
If you are using Terraform, refer to the following pages:
To define overrides in the Cloudflare dashboard, refer to the following resources:
- Configure a WAF managed ruleset in the dashboard
- Configure HTTP DDoS Attack Protection in the dashboard
- Configure Network-layer DDoS Attack Protection in the dashboard
Work with overrides
You can override a ruleset at three levels:
- Ruleset overrides apply to all rules in the executed ruleset.
- Tag overrides apply to all rules with a specific tag. For example, use a tag override to customize the Cloudflare Managed Ruleset so all rules with the
wordpresstag are set to Block. If multiple tags have overrides and if a given rule has more than one of these tags, the tag overrides order determines the behavior. For rules tagged with multiple overridden tags, the last tag's overrides apply. - Rule overrides apply to specific rules in a managed ruleset, referenced by their Rule ID.
Specific overrides take precedence over more general ones, and rule overrides take precedence over tag overrides, which take precedence over ruleset overrides.
Important
Ruleset overrides and tag overrides apply to both existing and future rules in the managed ruleset. If you want to override existing rules only, you must use rule overrides.
To apply an override for a managed ruleset:
- Use one of the update ruleset operations to update your phase entry point ruleset.
- Specify the
overridesin theaction_parametersof the rule that executes your managed ruleset.
"action_parameters": {
"id": "<RULESET_ID>",
"overrides": {
// ruleset overrides
"property-to-modify": "value",
"property-to-modify": "value",
// tag overrides
"categories": [
{
"category": "<TAG_NAME>",
"property-to-modify": "value",
"property-to-modify": "value"
}
],
// rule overrides
"rules": [
{
"id": "<RULE_ID>",
"property-to-modify": "value",
"property-to-modify": "value"
}
]
}
}
You can override the following rule properties:
"action""enabled"
Some managed rulesets may have additional override requirements, or they may allow you to override other rule properties. Check each Cloudflare product’s documentation for details.
Important
It is not recommended that you enable all the rules in a managed ruleset at the account level using an override, since this change could affect all the zones in your account. Some rules are disabled by default, since they could eventually affect legitimate traffic, and should not be enabled across zones without previous consideration.
Examples
Rule override example
The following PUT request adds a rule that executes a managed ruleset in the http_request_firewall_managed phase at the zone level, and defines a rule override to enable rule <RULE_ID> and set its action to log.
<details>
<summary>
Required API token permissions
</summary>
At least one of the following <a href="https://developers.cloudflare.com/fundamentals/api/reference/permissions/">token permissions</a> is required:
- <code>Response Compression Write</code>
- <code>Config Settings Write</code>
- <code>Dynamic URL Redirects Write</code>
- <code>Cache Settings Write</code>
- <code>Custom Errors Write</code>
- <code>Origin Write</code>
- <code>Managed headers Write</code>
- <code>Zone Transform Rules Write</code>
- <code>Mass URL Redirects Write</code>
- <code>Magic Firewall Write</code>
- <code>L4 DDoS Managed Ruleset Write</code>
- <code>HTTP DDoS Managed Ruleset Write</code>
- <code>Sanitize Write</code>
- <code>Transform Rules Write</code>
- <code>Select Configuration Write</code>
- <code>Bot Management Write</code>
- <code>Zone WAF Write</code>
- <code>Account WAF Write</code>
- <code>Account Rulesets Write</code>
- <code>Logs Write</code>
- <code>Logs Write</code>
</details>
Update a zone entry point rulesetbash
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 '{
"description": "Deploy managed ruleset, enabling a specific rule with log action",
"rules": [
{
"action": "execute",
"expression": "true",
"action_parameters": {
"id": "<MANAGED_RULESET_ID>",
"overrides": {
"rules": [
{
"id": "<RULE_ID>",
"enabled": true,
"action": "log"
}
]
}
}
}
]
}'
Ruleset override example
The following PUT request adds a rule that executes a managed ruleset in the http_request_firewall_managed phase at the account level, and defines a ruleset override that sets the action to log for all (enabled) rules.
<details>
<summary>
Required API token permissions
</summary>
At least one of the following <a href="https://developers.cloudflare.com/fundamentals/api/reference/permissions/">token permissions</a> is required:
- <code>Mass URL Redirects Write</code>
- <code>Magic Firewall Write</code>
- <code>L4 DDoS Managed Ruleset Write</code>
- <code>Transform Rules Write</code>
- <code>Select Configuration Write</code>
- <code>Account WAF Write</code>
- <code>Account Rulesets Write</code>
- <code>Logs Write</code>
</details>
Update an account entry point rulesetbash
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 '{
"description": "Deploy managed ruleset for example.com, overriding the rules action to log",
"rules": [
{
"action": "execute",
"expression": "(cf.zone.name eq \"example.com\") and cf.zone.plan eq \"ENT\"",
"action_parameters": {
"id": "<MANAGED_RULESET_ID>",
"overrides": {
"action": "log"
}
}
}
]
}'
More resources
For additional examples of configuring overrides via API, refer to Override examples.
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/ruleset-engine/managed-rulesets/override-managed-ruleset/#page","headline":"Override a managed ruleset","description":"Customize the behavior of managed rulesets with overrides.","url":"https://developers.cloudflare.com/ruleset-engine/managed-rulesets/override-managed-ruleset/","inLanguage":"en","image":"https://developers.cloudflare.com/ruleset-engine/managed-rulesets/override-managed-ruleset/og.png?v=4181ba450ed1c367","dateModified":"2026-04-16","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: Create, deploy, and manage custom rulesets using the API. title: Work with custom rulesets image: https://developers.cloudflare.com/ruleset-engine/custom-rulesets/og.png?v=23aff571ffcf4bd2
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/ruleset-engine/llms.txt
Use this file to discover all available pages before exploring further.
Docs