Cloudflare Docs
WAF
Visit WAF on GitHub
Set theme to dark (⇧+D)

Custom rules

Custom rules allow you to control incoming traffic by filtering requests to a zone. You can perform actions like Block or JS Challenge on incoming requests according to rules you define.

To define sets of custom rules that apply to more than one zone, use custom rulesets.

Like other rules evaluated by Cloudflare’s Ruleset Engine, custom rules have an expression and an action:

  • The expression specifies the criteria you are matching traffic on using the Rules language.
  • The action specifies what to perform when there is a match for the rule.

​​ Next steps

To create custom rules using the Cloudflare dashboard, refer to Create custom rules in the dashboard.

You can also create custom rules using the Rulesets API. Refer to Create custom rules via API for more information.