Creating Your First WAF Rule
To create a custom WAF rule, use the + New Rule button on Console → WAF → [domain] → Rules. The rule engine works on a Field → Operator → Value pattern; no code required.
How to add a rule
Section titled “How to add a rule”As an example, let’s block a specific IP address:
-
Open Console → WAF → [domain] → Rules and click + New Rule.
-
Give the rule a name (e.g.
ip-block). -
Build the condition: Field → IP Address (
ip.src), Operator → equals (==), Value → the IP you want to block (203.0.113.42). -
Choose Block as the action and save. The rule propagates to all edge servers instantly.
The logic of the rule is:
IF ip.src == 203.0.113.42THEN blockYou can combine multiple conditions with Add Condition (AND) and Add Group (OR).
Explore the rule engine
Section titled “Explore the rule engine”When you add a condition while building a rule, you can match on many fields — IP, country, bot score, HTTP headers and more. For the full list of fields, see Fields. The options used to compare them live in Operators, and the things you can do on a match (block, redirect, rate limit, etc.) in Actions. To see end to end how a rule is built, along with the syntax, visit Rule Engine Overview.