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.

TOML
[waf]
mode     = "block"        # "log" to observe first
managed  = { ruleset = "core", sensitivity = "medium" }
exclude  = ["/api/webhooks/*"]   # signed by the sender, inspected by your app

Start 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.

TOML
[[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.

TOML
[[waf.rate_limits]]
match  = "/api/*"
limit  = 600
window = "1m"
key    = 'header("x-api-key") || ip'
action = { type = "block", duration = "5m", status = 429 }

Actions

ActionEffect
blockRespond with 403 (or the configured status) and stop.
challengeServe a lightweight proof-of-work page; real browsers pass automatically.
logRecord the match and continue.
allowSkip 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:

TOML
[[waf.overrides]]
match    = "/cms/editor/*"
disable  = ["942100", "941160"]
Was this page helpful? Tell us what was missing at support@cache.bz. Every message is read by the team that writes these docs.