The sites I host need different traffic rules. I wanted to give each owner control over those rules and keep the time spent checking an ordinary request small.
How it fits together
1RequestTLS terminated
2Lists and WAFIP, network, rules, paths
3Bots and limitsscoring, challenges, rate limits
4Cache or originper-site settings
Implementation
One request pipeline
Each request passes through a Lua pipeline: routing by host, allow and deny lists by IP and network, WAF rules, path rules, rate limits, bot scoring and challenges, then the cache or the origin.
Configuration without round trips
Rules and settings are read from a three-tier cache inside the worker, with a tight timeout on Redis, so a request does not wait on the network for its configuration.
Rules site owners control
Each site can have its own rules to block, allow, challenge or rate-limit traffic.
Updating the firewall
A new edge image is compared with the running version before it rolls out, and the fleet can go back to the last good image in one step.