Documentation menu
Docs › Security
WAF basics
The web application firewall inspects requests at the edge and blocks attacks before they reach your origin or your cache.
Managed rules
Managed rule sets cover the common attack classes: SQL injection, cross-site scripting, path traversal, remote file inclusion, known scanner signatures, and exploits for popular CMS platforms. Our security team updates them continuously; you choose how strictly they apply.
[waf]
mode = "block" # "log" to observe first
managed = { ruleset = "core", sensitivity = "medium" }
exclude = ["/api/webhooks/*"] # signed by the sender, inspected by your appStart new sites in log mode for a few days, review what would have been blocked in the security events view, then switch to block.
Custom rules
Custom rules use the same expression language as cache rules and run before managed rules.
[[waf.rules]]
name = "Admin only from office VPN"
when = 'path.starts_with("/wp-admin") && !ip.in(["198.51.100.0/24"])'
action = "block"
[[waf.rules]]
name = "Challenge old clients on login"
when = 'path == "/login" && tls.version < "1.2"'
action = "challenge"Rate limiting
Rate limits count requests per client over a sliding window and act when the threshold is crossed. Clients are identified by IP address by default, or by a header such as an API key.
[[waf.rate_limits]]
match = "/api/*"
limit = 600
window = "1m"
key = 'header("x-api-key") || ip'
action = { type = "block", duration = "5m", status = 429 }Actions
| Action | Effect |
|---|---|
block | Respond with 403 (or the configured status) and stop. |
challenge | Serve a lightweight proof-of-work page; real browsers pass automatically. |
log | Record the match and continue. |
allow | Skip all remaining WAF rules for this request. |
Tuning false positives
Every blocked request has a rule ID in the security events log and in the x-cachebz-waf response header. Disable a single rule for one path rather than lowering sensitivity for the whole site:
[[waf.overrides]]
match = "/cms/editor/*"
disable = ["942100", "941160"]