Skip to content

Cloudflare WAF false positives: find the exact rule before you touch anything

A customer got "Sorry, you have been blocked" on a legitimate request. How to trace the Ray ID in Security Events to the exact rule that fired, and why a scoped exception beats disabling the rule.

When a real user reports a Cloudflare block page, resist the two reflex moves: turning the WAF off and guessing which rule did it. Every block and challenge carries a Ray ID, and Security > Events maps that Ray ID to the exact service, rule ID, and matched request. Triage is a three-step loop: identify the rule from the event, decide whether the rule is wrong or the request is unusual, then write the narrowest exception that unblocks the traffic — never a zone-wide disable.

What’s happening

A request hitting your zone passes through Cloudflare’s security layers in a fixed order: DDoS mitigation, IP Access rules, WAF custom rules, rate limiting rules, then managed rulesets, with the bot products (Bot Fight Mode on Free, Super Bot Fight Mode on Pro and Business) applying their own verdicts alongside. The first terminal action — Block or a challenge — ends the evaluation, and only that one rule shows up as the deciding event.

False positives cluster in the managed layer. Free zones run the slim Cloudflare Free Managed Ruleset, which rarely misfires. Pro and Business zones run the full Cloudflare Managed Ruleset plus the OWASP Core Ruleset, and OWASP is where legitimate traffic gets hurt: it scores many small signals and blocks when the sum crosses a threshold, so a CMS editor saving a post that contains HTML, SQL-looking prose, or a base64 blob can cross the line with no single “bad” pattern. Custom rules you wrote yourself are the second source — usually an expression that matched more than intended. The decision you owe the zone is exception versus disable: an exception skips one rule (or one ruleset) for a scoped expression; disabling removes the protection for every request on the zone.

What to check first

  • Get the Ray ID from the person who was blocked. The block page prints Cloudflare Ray ID: <hex> at the bottom. Without it you are searching by IP and timestamp, which is slower and ambiguous on shared IPs.
  • Confirm it was actually Cloudflare. A 403 from your origin (mod_security, a WordPress security plugin) has no Cloudflare block page and no cf-mitigated header. Only edge verdicts appear in Security > Events.
  • Establish what the user was doing. Saving a page-builder layout, uploading a file, posting a long comment — the request body usually explains why an OWASP score tipped.
  • Check the Service column before blaming managed rules. Rate limiting, a custom rule, or Bot Fight Mode produce the same user-facing wall.

How to verify

Reproduce the block yourself and capture the evidence:

# Reproduce and keep headers + body
curl -s -D - -o /tmp/blocked.html "https://www.example.com/wp-json/wp/v2/posts" \
  -X POST -H "Content-Type: application/json" \
  --data '{"content":"1 OR 1=1 -- test payload"}'

# Edge verdict, not origin: status 403 + server: cloudflare
# cf-mitigated: challenge means a challenge page, not a hard block
grep -oE "Cloudflare Ray ID: [a-f0-9]+" /tmp/blocked.html

Then look the Ray ID up in the dashboard:

Security > Events
  Filter: Ray ID equals 8f1b2a3c4d5e6f70
  Read:   Action taken   (Block / Managed Challenge / Log)
          Service        (Managed rules / Custom rules / Rate limiting / Bot Fight Mode)
          Rule           (rule ID + description, e.g. OWASP score threshold)
          Additional matches (other rules that matched but did not decide)

Finally, test from a clean IP — a mobile hotspot or a VPS your office does not share — to rule out IP reputation as a co-factor:

# From a different network: same request, does it pass?
curl -s -o /dev/null -w "%{http_code}\n" "https://www.example.com/wp-json/wp/v2/posts" \
  -X POST -H "Content-Type: application/json" --data '{"content":"plain text"}'

If the plain-text body passes and the original body blocks from every IP, the rule is reacting to the payload; if only one office IP gets blocked, you are looking at reputation or an IP-scoped rule instead.

The fix

  1. Identify the deciding rule, not just the ruleset. In the event details, note the Service and the rule ID. For OWASP blocks, expand the event: the deciding “rule” is the score threshold, and the contributing rules are listed with their individual scores — those are what you tune.
  2. For a managed rule: add an exception above it. Go to Security > WAF > Managed rules and add an exception (a Skip for managed rules) scoped as tightly as you can — for example http.request.uri.path eq "/wp-json/wp/v2/posts" and http.request.method eq "POST" — and choose to skip only the specific rule ID that fired. Skipping the whole ruleset for that path is the fallback, not the first move.
  3. For an OWASP block: lower the sensitivity or skip the noisy contributor. Raising the score threshold (lower sensitivity) affects the whole zone; skipping the one contributing rule for the one path affects almost nothing else. Prefer the narrow move. The mechanics of expressions and actions are covered in WAF custom rules: block, challenge, log, skip.
  4. For your own custom rule: fix the expression. Add the missing condition (method, path prefix, content type) rather than deleting the rule. Flip it to Log for a day if you are unsure, then read Security > Events to confirm the refined expression only matches what you intended.
  5. For rate limiting or bot services: treat it as a different problem. A rate-limit block means the threshold does not fit real usage; a Bot Fight Mode event means the client looks automated. Both have their own tuning paths — do not add managed-rule exceptions for them.
  6. Re-test both directions. The blocked request must now pass, and a genuinely malicious probe (an obvious SQLi string against a random path) must still be blocked. An exception that also unblocks attackers is too wide.

When this fix is wrong

If the “false positive” is a security scanner, a pentest, or a vulnerability probe that happened to hit a legitimate user’s shared VPN IP, the rule did its job — fix the shared-IP experience with a challenge instead of an exception. And if the block only appears on one path that no human uses, consider that the rule may be correctly protecting an endpoint you forgot existed.

Common mistakes

  • Disabling the entire OWASP ruleset because one editor got blocked once.
  • Adding an exception scoped to an IP address for a payload problem — the same user gets blocked from home tomorrow.
  • Trusting the user-facing error alone: “Access denied” pages from origin plugins get blamed on Cloudflare weekly, as we see with WordPress cases like the ones in Cloudflare managed rulesets on WordPress.
  • Forgetting that exceptions are ordered: an exception placed below the rule it should skip does nothing.

Prevention

Roll out new rules in Log mode and read their matches for a few days before enforcing, keep every exception commented with the rule ID and the ticket that justified it, and review exceptions quarterly — half of them usually protect workflows that no longer exist. Cloudflare’s own reference for managed rule exceptions is at developers.cloudflare.com/waf/.

Tuning edge security so it blocks attacks without blocking customers is ongoing work — Stack Harbor watches those events around the clock under 24/7 Monitoring & Response; book a monitoring and response review.