跳转到主要内容

Deploy a managed ruleset

import { RuleID, Render } from "~/components";

You can deploy a managed ruleset at the zone level or at the account level. To deploy a managed ruleset to a phase, use the Rulesets API.

If you are using Terraform, refer to WAF Managed Rules configuration using Terraform for more information.

If you are using the Cloudflare dashboard, refer to the following pages:

Deploy a managed ruleset to a phase at the zone level

Use the following workflow to deploy a managed ruleset to a phase at the zone level.

  1. Get your zone ID.
  2. Invoke the List account rulesets operation to obtain the available managed rulesets. Managed rulesets exist at the account level, but you can deploy them to a zone. Find the ruleset ID of the managed ruleset you want to deploy.
  3. Identify the phase where you want to deploy the managed ruleset. Ensure that the managed ruleset belongs to the same phase where you want to deploy it.
  4. Add a rule to the zone-level phase entry point ruleset that executes the managed ruleset. Refer to the following example for details on this step.

Example

In this example, the managed ruleset executes the behavior configured by Cloudflare. To customize the behavior of managed rulesets, refer to Override a managed ruleset.

Deploy a managed ruleset to a phase at the account level

Use the following workflow to deploy a managed ruleset to a phase at the account level.

  1. Get your account ID.
  2. Invoke the List account rulesets operation to obtain the available managed rulesets. Find the ruleset ID of the managed ruleset you want to deploy.
  3. Identify the phase where you want to deploy the managed ruleset. Ensure that the managed ruleset belongs to the same phase where you want to deploy it.
  4. Add a rule to the account-level phase entry point ruleset that executes the managed ruleset. Use parentheses to enclose any custom conditions in the rule expression and end your expression with and cf.zone.plan eq "ENT" so that it only applies to zones on an Enterprise plan. Refer to the following example for details on this step.

Example

In this example, the managed ruleset executes the behavior configured by Cloudflare. To learn how to customize the behavior of managed rulesets, refer to Override a managed ruleset.