Fill in the fields below and copy the generated rule straight into your own WAF config. Runs entirely in your browser -- nothing you enter here is sent anywhere.
This runs entirely client-side -- nothing you type is sent to ShieldIngress or anywhere else. Always review generated rules before deploying them to a live WAF.
New to these fields? Read our guide to variables, operators, and exemptions.
The builder writes a rule in SecLang, the rule language used by ModSecurity and Coraza. You choose what part of the request to look at, how to compare it, and what to do when it matches; the builder turns that into a SecRule with the quoting and escaping already handled. It makes two kinds of rule:
What you can match on: the request URI, query string, any argument or argument name, request headers or header names, cookies, the raw request body, the full request line, the request method, uploaded file names and the client IP. Arguments, headers and cookies can be narrowed to one named field.
How you can compare: contains, equals exactly, begins with, ends with, regular expression, any of a list of phrases, IP address or CIDR range, and the built-in SQL injection and XSS detectors. Any condition can be negated with NOT, and text comparisons can ignore case.
Add more than one condition and they're joined with AND: the builder writes a chained rule, so every condition has to match.
Say you want to block the WordPress login page for everyone except your office network. Two conditions do it: the request URI begins with /wp-login.php, AND the client IP is NOT in 203.0.113.0/24. With the description "Login page: office only", the builder produces:
SecRule REQUEST_URI "@beginsWith /wp-login.php" "id:1000001,phase:2,deny,status:403,msg:'Login page: office only',t:none,chain"
SecRule REMOTE_ADDR "!@ipMatch 203.0.113.0/24" "t:none"
SecRule REQUEST_URI "@beginsWith /wp-login.php": the first condition. Look at the request URI and check whether it starts with that path.id:1000001: every rule needs a unique ID. The builder starts at 1000001.phase:2: run after the request headers and body have been read. Block rules use phase 2 so conditions on the body work too.deny,status:403: what happens on a match. With "Log only" selected this becomes pass,log.msg:'…': your description, written to the WAF log whenever the rule matches.t:none: no transformation before comparing. With "Ignore case" ticked this becomes t:lowercase.chain: the next line is part of this rule and must also match.SecRule REMOTE_ADDR "!@ipMatch 203.0.113.0/24": the second condition. The ! means NOT, so the rule only fires for IPs outside that range.An exemption looks similar but runs in phase:1 with pass,nolog, and ends with ctl:ruleRemoveById=942100 (or ctl:ruleRemoveTargetById=942100;ARGS:content to skip one field), so the rule you're exempting never sees those requests. For a walk-through of each field, see writing a WAF rule with the rule builder.
Paste it into a .conf file your WAF loads, the same way your other rules are included. With ModSecurity on Apache or Nginx, or with Coraza, that's usually a custom rules file referenced from the main config. If you run the OWASP Core Rule Set (CRS), exemptions belong in a file that loads before the CRS rules (CRS ships REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf for exactly this); block rules can go before or after it.
Every ID has to be unique across everything your WAF loads, or it will refuse to start. The builder won't accept IDs from 800000 to 999999, to stay clear of the range CRS uses. Pick a block of IDs for your own rules and number them from there.
Set the response to "Log only" first, or run the whole engine with SecRuleEngine DetectionOnly, and watch the log for a few days. If the rule only matches the traffic you meant, switch it to block. A rule that's too broad blocks real visitors, and the first you hear of it is a complaint.
admin also matches /badminton. Use "Begins with", or anchor the pattern with ^.apachectl configtest or nginx -t) before reloading, so a typo doesn't take the site down.ShieldIngress is a managed web application firewall built on Coraza and the OWASP Core Rule Set. Put your site behind it and add custom rules and exemptions like these from the portal, with bot protection, rate limiting and automatic SSL included.
Start Free Trial