Cloudflare Managed Ruleset
Created by the Cloudflare security team, this ruleset provides fast and effective protection for all of your applications. The ruleset is updated frequently to cover new vulnerabilities and reduce false positives.
Cloudflare recommends that you enable the rules whose tags correspond to your technology stack. For example, if you use WordPress, enable the rules tagged with wordpress
.
Cloudflare’s WAF changelog allows you to monitor ongoing changes to the WAF’s managed rulesets.
You can configure the following settings of the Cloudflare Managed Ruleset in the Cloudflare dashboard:
- Set the action to perform. When you define an action for the ruleset, you override the default action defined for each rule. The available actions are: Managed Challenge, Block, JS Challenge, Log, and Interactive Challenge. To remove the action override, set the ruleset action to Default.
- Override the action performed by individual rules or rules with specific tags. The available actions are: Managed Challenge, Block, JS Challenge, Log, and Interactive Challenge.
- Disable specific rules or rules with specific tags.
- Customize the filter expression. With a custom expression, the Cloudflare Managed Ruleset applies only to a subset of the incoming requests.
- Configure payload logging.
For details on configuring a managed ruleset in the dashboard, refer to Configure a managed ruleset.
To enable the Cloudflare Managed Ruleset for a given zone via API, create a rule with execute
action in the entry point ruleset for the http_request_firewall_managed
phase.
The following example deploys a WAF managed ruleset to the http_request_firewall_managed
phase of a given zone ({zone_id}
) by creating a rule that executes the managed ruleset.
-
Invoke the Get a zone entry point ruleset operation to obtain the definition of the entry point ruleset for the
http_request_firewall_managed
phase. You will need the zone ID for this task. -
If the entry point ruleset already exists (that is, if you received a
200 OK
status code and the ruleset definition), take note of the ruleset ID in the response. Then, invoke the Create a zone ruleset rule operation to add anexecute
rule to the existing ruleset deploying the Cloudflare Managed Ruleset (with IDefb7b8c949ac4650a09736fc376e9aee
). By default, the rule will be added at the end of the list of rules already in the ruleset. -
If the entry point ruleset does not exist (that is, if you received a
404 Not Found
status code in step 1), create it using the Create a zone ruleset operation. Include a single rule in therules
array that executes the Cloudflare Managed Ruleset (with IDefb7b8c949ac4650a09736fc376e9aee
) for all incoming requests in the zone.
To configure the Cloudflare Managed Ruleset via API, create overrides using the Rulesets API. You can perform the following configurations:
- Specify the action to perform for all the rules in the ruleset by creating a ruleset override.
- Disable or customize the action of individual rules by creating rule overrides for those rules.
For examples of creating overrides using the API, refer to Override a managed ruleset.
For more information on working with managed rulesets via API, refer to Work with managed rulesets in the Ruleset Engine documentation.