How do you test a new Cloudflare WAF custom rule against live traffic before it blocks anyone, on Enterprise and on lower plans?
answer
- an action that only records
- plan boundary on that action
- a softer action first
- validation is not testing
basics
~20 sOn Enterprise, deploy the rule with the Log action and read its matches in Security Events. Log is Enterprise-only, so on Free, Pro and Business start with Managed Challenge, review the matched requests, then switch to Block.
solid answer
~40 sThe **Log** action records matches without acting on them, and Cloudflare recommends it for validating a rule. It exists only on Enterprise. On other plans the dashboard's advice is to deploy with **Managed Challenge** first, review the matched requests in **Security Events**, then change to Block. Real people who match can still pass, so a mistake costs friction rather than an outage. While it runs, I filter Security Events by the rule and check the top paths, ASNs, countries and user agents it caught, and I watch its Challenge Solve Rate. A high rate means humans are matching. Two things look like testing but are not. **Save as Draft** stores a rule without running it. The Rulesets API's `dry_run=true` validates syntax, permissions and quotas without publishing, but never evaluates traffic.
go deeper
Recall that Log records matches without acting and is Enterprise-only, and that other plans trial with Managed Challenge first.
Explain how to read Security Events for a trial rule and why Save as Draft and dry_run=true validate a rule without testing it.
Show the judgment in a trial: scoping out clients that cannot solve challenges, reading the solve rate, and deciding the evidence is enough to switch to Block.
Argue for a team rule that every new custom rule ships through a recorded trial, and say who signs off on the switch to Block.
## Why test a custom rule at all A custom rule is only as good as its expression, and an expression that looks right can match far more than intended. A missing parenthesis, a case-sensitive comparison or an over-broad country set can block customers the moment the rule is deployed. Testing means seeing **which real requests the rule matches** before the action hurts anyone. ## The Log action and its plan boundary The **Log** action (API value `log`) records each matching request and does nothing else. It is not terminating, so evaluation continues to the following rules. Cloudflare recommends it for validating rules before committing to a more severe action. The catch is the plan: **Log is available on Enterprise plans only.** Free, Pro and Business zones can use every other custom rule action but not this one. ## The lower-plan path: Managed Challenge first For plans without Log, Cloudflare's dashboard guidance is: 1. Deploy the rule with **Managed Challenge** instead of Block. 2. Review the matched requests in **Security Events**. 3. Switch the action to **Block** once the matches look right. This works because a Managed Challenge lets real people through, usually without interaction. A wrong expression then costs some visitors a short challenge rather than an outage. It is not free: - clients that cannot solve a challenge page (API calls, mobile apps, partner integrations, monitoring probes) fail outright, so scope them out of the trial rule first; - the challenge itself changes behaviour, since scrapers abandon it, so what you observe is already partly mitigated. ## Reading Security Events While the trial runs, Security Events is the evidence: - Filter by the rule; events from custom rules show **Custom Rules** as their source. - Use **Top events by source** to see which IP addresses, ASNs, countries, paths, hosts and user agents the rule catches. A path or network you did not expect is a sign the expression is too broad. - For a challenge rule, watch the **Challenge Solve Rate** on the Security rules page. A high rate means many real visitors are solving it. - Remember that events can be sampled. Use them to judge the shape of the traffic, not as an exact count. ## Validation is not testing Two features check a rule without telling you anything about traffic: | Tool | What it checks | Evaluates live requests? | |---|---|---| | **Save as Draft** | Nothing; stores the rule undeployed | No | | Rulesets API `dry_run=true` | Expression syntax, action parameters, permissions, plan features, quotas | No | | **Log** action (Enterprise) | Which requests match, with no effect on them | Yes | | **Managed Challenge** trial | Which requests match, with friction for them | Yes | The dashboard now runs the same validation automatically when you create or update a rule. Through the API, `dry_run=true` performs the change's authorization and server-side checks without persisting it, and returns `result: null` where the call would normally return 200. Use it in CI before a real publish. It catches a broken expression or a quota overrun, not a rule that is valid but wrong. ## A worked trial The operations team wants to block the scraper's two networks on the search endpoint, on a Pro zone: 1. Write the rule, `http.request.uri.path eq "/search" and ip.src.asnum in {64496 64500}`, and let the dashboard validate it on save. 2. Deploy it with **Managed Challenge**, not Block, and note the time. 3. After a day, open Security Events for the rule. Top events by source should show the two ASNs and the one path. A third network, or a second path, means the expression is wider than intended. 4. Look at the solve rate. Scrapers mostly abandon challenges, so the rate should be low; a noticeable share of solved challenges hints that real users share those networks. 5. If people do share them, keep Managed Challenge as the permanent action instead of Block. The scraper is still stopped, and the humans still get through. The last step is the point of the trial: it decides not only whether the expression is right, but which action the rule should end with. ## When to switch to Block - The matched paths, networks and countries are the ones you meant. - The solve rate is low, so mostly automated clients are matching. - No partner, monitor or app traffic appears among the matches. Then change the action to Block and keep watching Security Events for the first days.
- What exactly does `dry_run=true` on a Rulesets API call check?It runs the same authorization and server-side validation as the real change: invalid expressions, bad action parameters, missing permissions, features the plan lacks and quota limits. Then it discards the change instead of publishing it. A request that would return 200 returns `result: null`; one that returns 204 still does. It never shows which requests the rule would match.
- Why is a Managed Challenge trial not completely safe?Because some legitimate clients cannot solve any challenge: a single-page app's fetch calls, native mobile apps, partner backends and monitoring probes. They receive an HTML challenge page marked `cf-mitigated: challenge` instead of their response. Exclude those paths or addresses from the trial rule, or put a Skip rule for them above it, before deploying.
- Every Cloudflare plan can deploy a custom rule with the Log action.
- A Rulesets API dry run shows which live requests a rule would have matched.
- Saving a rule as a draft runs it in a monitoring-only mode.
- A Managed Challenge trial cannot affect any legitimate client.
- Once the expression saves without an error, it matches only what was intended.
Assumes Cloudflare as of October 2026: the Rulesets API's dry_run=true option and automatic dashboard validation arrived on 2026-09-17; the Log action remains Enterprise-only.