WAF Auto-Block depends on three Cloudflare resources that must exist before the service starts: an account-level IP list that holds the addresses it blocks, a WAF custom rule in your zone that enforces the block when a source IP appears in that list, and a scoped API token the service uses to read analytics and manage the list. The service cannot function correctly if any of these are missing — it will start and poll successfully, but IPs it tries to add will fail if the list does not exist, and IPs that are successfully added will have no effect if the WAF rule is not active. Work through the steps below in order before proceeding to the Quickstart.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/proteo5/waf-autoblock/llms.txt
Use this file to discover all available pages before exploring further.
Create an account-level IP list
Account-level IP lists are managed from your Cloudflare dashboard at the account scope, not the zone scope.
- Log in to the Cloudflare dashboard.
- Select Account Home from the top navigation and choose your account.
- Navigate to Manage Account → Lists.
- Click Create a list.
- Set the list type to IP.
- Give it a descriptive name such as
auto_blocked_ips. The name must contain only lowercase letters, digits, and underscores. - Click Create.
Cloudflare__BlocklistId in your service configuration.Create a WAF custom rule that enforces the blocklist
The IP list alone does not block any traffic. You need a WAF custom rule in your zone that tells Cloudflare to block requests when the source IP is present in the list.
- In the Cloudflare dashboard, select your zone.
- Navigate to Security → WAF → Custom Rules.
- Click Create rule.
-
Give the rule a name such as
Block auto-blocked IPs. -
In the rule expression field, enter:
Replace
auto_blocked_ipswith the name you chose for your list if it differs. - Set the action to Block.
- Set the rule’s position so it executes at a higher priority (lower order number) than the WAF rules you want WAF Auto-Block to react to. This ensures that once an IP is added to the list it is blocked immediately, even if it continues to trigger the lower-priority rules.
- Enable the rule and save.
The WAF custom rule that blocks
ip.src in $auto_blocked_ips must be active before the service starts adding IPs. Cloudflare evaluates rules in priority order — if this rule is disabled or positioned after the rules that trigger blocking, IPs added by WAF Auto-Block will not be blocked by Cloudflare even though they appear in the list.Identify the WAF rule IDs you want to monitor
WAF Auto-Block uses an explicit allowlist of Cloudflare WAF rule IDs. Events for any rule that is not in your configuration are ignored by design. You must find the exact Cloudflare rule ID for each rule you want the service to react to.To locate a rule ID:Repeat the block with
- In the Cloudflare dashboard, navigate to Security → WAF.
- Browse your Managed Rules or Custom Rules and open the rule you want to monitor.
- The rule ID is displayed in the rule details. For managed rules, it is typically a long hex string such as
100015or a UUID. Copy the exact value — rule IDs are case-sensitive.
Rules__1__, Rules__2__, etc. for additional rules. Each rule has its own independent threshold and TTL.Create a scoped API token
WAF Auto-Block requires a Cloudflare API token — not a Global API Key. The token needs exactly two permission scopes.
- Log in to the Cloudflare dashboard and click your profile icon in the top right.
- Select My Profile → API Tokens.
- Click Create Token.
- Choose Create Custom Token.
- Add the following permissions:
- Under Zone permissions, add Analytics → Read. Set the zone scope to the specific zone you want to monitor.
- Under Account permissions, add Account Filter Lists → Edit. Set the account scope to the account that owns your IP list.
- Set an appropriate expiration if your security policy requires token rotation.
- Click Continue to summary, review the scopes, then click Create Token.
- Copy the token value immediately — Cloudflare will not show it again.
waf-autoblock.env file or your secret store of choice:Required Token Scopes
| Scope | Type | Purpose |
|---|---|---|
| Zone > Analytics > Read | Zone | Query WAF and HTTP analytics via the Cloudflare GraphQL API |
| Account > Account Filter Lists > Edit | Account | Add and remove IPs from the account-level IP list |