Cloudflare’s WAF is genuinely powerful, and that’s exactly where the trouble starts. Between custom rules, managed rulesets, rate limiting rules, and attack scoring, your security logic becomes a layered system with an execution order that decides which protections actually run. Add a second zone, a few engineers making changes without documentation, and the emergency exception someone added during an incident and never reverted, and your rule set has quietly drifted from the thing you designed, which is why Cloudflare configuration management matters.
This is a guide to Cloudflare WAF rules as a system, written for operators, not as a rewrite of the docs. The reference material tells you what each rule type is. It doesn’t tell you how they interact, what happens when a custom rule short-circuits a managed ruleset, or how a rule set that made sense at ten rules becomes unmanageable at two hundred. That operational layer is what this covers, along with how to keep it all under control as your setup scales.
How Cloudflare WAF Rules Work
The single most important thing to understand about Cloudflare’s WAF is that it isn’t one filter. It’s a pipeline of rule types that evaluate each request in a defined sequence, and the sequence matters as much as the rules themselves. A request enters, passes through each phase in order, and the moment a rule with a terminating action like Block fires, evaluation stops and everything downstream never runs.
That last point is the one that trips teams up: a rule early in the pipeline can prevent a rule later in the pipeline from ever seeing the request. Your carefully tuned managed ruleset is worthless against a request that a custom rule already let through with a Skip action three phases earlier. The WAF does precisely what you configured, in precisely the order the phases dictate, and if you don’t know the order, you don’t actually know what your WAF does.
Types of Cloudflare WAF Rules

Four rule types do the work, each with a different job. Understanding what each is for is the prerequisite to combining them well.
Custom Rules
Custom rules are the ones you write, using Cloudflare’s Rules language to filter traffic by whatever request properties matter to you: IP address, URL path, headers, country, HTTP method, attack score, body content, and dozens more fields. When a request matches, you apply an action: Block, Managed Challenge, JS Challenge, Skip, or Log.
Two behaviors define how they run. They execute in the order you arrange them, top to bottom, and the first rule that matches with a terminating action ends evaluation for that request. That makes ordering a security decision, not a cosmetic one. A broad Skip rule sitting above a narrow Block rule means the Block never fires. Your custom rule count is also plan-gated: Free plans allow 5 custom rules, Pro allows 20, and Business allows 100, with Enterprise going considerably higher. That ceiling arrives faster than teams expect, which is part of why sprawl becomes a real problem.
Managed Rulesets
Managed rulesets are maintained by Cloudflare, not you, and they’re your fastest path to real coverage. Three matter most. The Cloudflare Managed Ruleset is signature-based protection against known attacks and vulnerabilities, updated continuously, including emergency rules for zero-days like the Log4j releases. The OWASP Core Ruleset works differently: it uses a scoring model where each matching rule adds its score to a cumulative threat score, and the configured action fires when that total exceeds your threshold. And the Free Managed Ruleset provides baseline protection on every plan.
The scoring distinction is the operationally important one. Signature rules are binary, a request matches or it doesn’t. The OWASP ruleset is a dial, and where you set the threshold determines your false-positive rate. Set it too aggressive and legitimate requests carrying rich content start tripping it; too permissive and real attacks score under the line. Critically, managed rules run in a later phase than custom rules, which means a terminating action in your custom rules prevents the managed ruleset from ever evaluating that request.
Rate Limiting Rules
Rate limiting rules cap how many requests a source can make within a time window, and they’re your application-layer defense against the volumetric abuse signatures can’t catch: credential stuffing against a login endpoint, brute-force attempts, API scraping, and card-testing against checkout. You define the matching expression, the threshold, the window, and the action.
Rate limiting is heavily plan-gated in both count and flexibility, so the sophistication available to you depends on your tier. Whatever tier you’re on, set thresholds per endpoint from real traffic data, not one global guess, because your login page and your product catalog tolerate wildly different request rates.
WAF Attack Score
Attack score is Cloudflare’s machine-learning layer, and it exists to catch what signatures miss. It scores requests for attack patterns like SQL injection, XSS, and RCE independently of the signature-based managed rules, expressed on a scale where a low number means likely malicious and a high number means likely clean. The value in catching novel payloads is that ML generalizes where a signature only matches what it was written for.
Here’s the part the docs underplay: attack score does nothing on its own. It’s a detection signal, not an action. To use it, you reference the score inside a custom rule or rate limiting rule and decide what to do with low-scoring traffic. That design is actually the point, because it lets you combine Cloudflare’s ML detection with your own logic, challenging low-score requests to an endpoint while blocking them outright on a more sensitive one. Attack score is a higher-tier feature, so availability depends on your plan.
Cloudflare WAF Rule Execution Order
Now the thing that ties it all together, and the thing most WAF misconfigurations come back to. Cloudflare evaluates the rule types in a fixed sequence: IP Access rules first, then your custom rules, then rate limiting rules, then the managed rulesets. A rule with a terminal action in any earlier phase stops the request from ever reaching the later phases.
Read that sequence again with the implications in mind, because each phase boundary is a place where an earlier decision overrides a later protection. A custom rule that blocks or skips runs before the managed ruleset, which means an overly broad custom rule can quietly disable the OWASP protections you think are covering that traffic. This is not a rare edge case. It’s one of the most common ways a Cloudflare WAF ends up weaker than its owner believes, because the rule set looks complete in the dashboard while the execution order silently routes around half of it.
Exceptions deserve a specific mention here, because they interact with order too. A skip rule only bypasses the managed rules listed after it, so an exception has to be placed before the rules it’s meant to skip. Get the placement wrong and the exception either does nothing or skips more than you intended. Understanding execution order isn’t optional for anyone managing a non-trivial rule set. It’s the difference between a WAF you’ve configured and a WAF you merely hope is working.
Building an Effective Cloudflare WAF Rule Strategy
With the mechanics clear, here’s how to assemble them into a rule set that’s strong and maintainable rather than sprawling and opaque.
Start with Managed Rulesets as Your Baseline
Deploy the Cloudflare Managed Ruleset and the OWASP Core Ruleset first, and let them carry the load they’re built for: broad, continuously updated coverage against known attack classes you’d otherwise have to track yourself. Then tune the OWASP threshold against your actual traffic. The default is a starting point, not an answer, and the right sensitivity for an API serving JSON differs from the one for a content site. Run it in log mode, watch what it would have caught and what it would have falsely flagged, and set the threshold from that evidence.
Layer Custom Rules for Your Specific Needs
Managed rules handle the universal threats. Custom rules handle the things only you know: block or challenge traffic to your admin path from outside the office range, geo-restrict endpoints that have no business serving certain regions, filter the bot patterns specific to your application, act on attack score thresholds. Keep each custom rule tightly scoped and clearly named. Given the plan ceiling on custom rule count, every rule should earn its slot, and a rule that tries to do five things is a rule nobody will understand in six months.
Use Attack Score in Custom Rules for Intelligent Filtering
This is where the system gets genuinely smart, and it’s underused. Instead of relying only on signature matches, write custom rules that act on attack score: challenge requests in a suspicious score band, block the ones deep in malicious territory, and tighten the threshold on your most sensitive endpoints while staying lenient on low-risk paths. Combining ML-based scoring with your own per-endpoint logic catches the novel attacks signatures miss without carpet-blocking everything ambiguous.
Create WAF Exceptions Carefully
Exceptions exist for a real reason: a legitimate request trips a managed rule, and a skip rule lets it through. But every exception is a hole you’re cutting in coverage you deployed on purpose, and holes have a way of outliving their justification. The rule is discipline: scope each exception as narrowly as the platform allows, one rule for one path, never a whole ruleset for a broad prefix. Name it with its reason. Set a review date. The exception added for a launch weekend that’s still live a year later is the single most common way a well-configured WAF rots.
The Problem Nobody Talks About: Managing Cloudflare WAF Rules at Scale

Everything above is achievable for a team that’s paying attention. Here’s what actually breaks, and it breaks quietly, over months, on setups that started clean.
Rule Sprawl and Lost Context
Custom rules accumulate the way any config accumulates: one incident at a time. The emergency block from a past attack is still active. The exception added for a specific deployment became permanent because nobody scheduled its removal. A rule references an IP range whose purpose left with the engineer who added it. Six months in, someone asks why rule 34 exists, the honest answer is that nobody knows, so nobody dares touch it. That’s how rule sets calcify: not through negligence, but through the ordinary accumulation of changes nobody wrote down.
Multi-Zone Inconsistency
Run more than one Cloudflare zone and consistency becomes a manual, error-prone chore, because a rule added to one zone does not replicate to the others. On non-Enterprise plans, WAF configuration is per-zone by design, so keeping ten zones aligned means making the same change ten times, correctly, every time. Nobody does that under incident pressure. So the zones drift away from a shared secure baseline, each carrying a slightly different security posture, and your protection becomes whatever the weakest zone happens to be running. You won’t discover the gap in a dashboard. You’ll discover it when something gets through the zone nobody updated.
No Native Version Control
Cloudflare’s audit logs tell you a rule changed and who changed it. They don’t hand you a full before-and-after diff of the rule’s logic, which is exactly what you need when a change breaks something and you have to understand what it used to be. Tracking how a rule evolved, and reconstructing a prior known-good state, means building or buying external tooling, because the native capability isn’t there. Until you do, every rule change is a small act of faith that you’ll remember the previous version if you need to roll back.
Translating Rules to Other Providers
The hardest problem arrives the moment you run Cloudflare alongside Akamai, Fastly, or AWS WAF. Translating a Cloudflare custom rule into another provider’s logic is slow and genuinely error-prone, because each platform has its own expression language, its own action model, and its own execution order. There is no clean one-to-one mapping. A rule that reads clearly in Cloudflare’s Rules language becomes an afternoon of documentation archaeology on another platform, and a single mistranslation is either a protection gap or a production outage.
This is the cluster of problems Lelops Advise is built to solve. It understands your Cloudflare WAF configuration, so anyone on the team can ask in plain language what a given rule does and why it exists, and get an answer grounded in the live configuration instead of guessing. It gives you the rule-evolution context Cloudflare’s audit log withholds, and it translates rule logic between Cloudflare and other providers without the hours of cross-referencing that manual translation demands. The rule set stops being tribal knowledge held by one engineer and becomes something the whole team can interrogate.
Keeping Your Cloudflare WAF Rules Healthy Over Time
Control isn’t a state you reach once. It’s maintenance you run, and four habits keep a rule set healthy.
Audit Your Rules Regularly
Schedule a quarterly pass over every custom rule and every managed-ruleset exception. For each one, answer a single question: is this still doing a job? Delete the rules that target threats you no longer face, update the ones matching outdated patterns, and give every exception a hard second look, because exceptions are where risk hides. A rule set nobody prunes only grows, and everything it accumulates is attack surface for your own confusion.
Document Every Rule’s Purpose
Every custom rule needs a descriptive name and a note capturing its intent, when it was created, and the condition under which it should be reviewed or removed. This sounds like bureaucracy until the 2 AM incident when you’re staring at a rule you don’t recognize and have to decide, fast, whether disabling it is safe. Documentation written calmly today is the context you’ll desperately want under pressure later.
Monitor Rule Performance
Use Cloudflare’s Security Analytics to see which rules actually fire, how often, and against what traffic. The data tells you things intuition won’t: a rule that never triggers may be obsolete or misconfigured, and a rule that triggers constantly may be too broad and generating false positives you haven’t noticed. Rules aren’t set-and-forget assertions. They’re hypotheses about your traffic, and the analytics tell you which ones are still true.### Test Before Deploying
Never send a new rule straight to Block. Deploy it in Log mode first, watch what it matches against real traffic, and confirm it catches what you intended without catching legitimate users. Only promote it to a terminating action once the evidence is in. This one habit prevents the most avoidable WAF incident there is: the rule that was supposed to stop attackers and blocked your customers instead, discovered via the support queue rather than a test.
Lelops Advise understands your Cloudflare WAF configuration. Ask what any rule does, get instant context, and translate rule logic across providers without hours of research: lelops.ai/product/advise.
FAQ
What are Cloudflare WAF rules?
Cloudflare WAF rules are the configurations that tell Cloudflare’s web application firewall which incoming requests to allow, challenge, or block. They span several types, including custom rules written by the operator, managed rulesets maintained by Cloudflare, and rate limiting rules, all evaluated against each request in a defined execution order. Together they filter HTTP and HTTPS traffic before it reaches the origin application.
What is the difference between custom rules and managed rules in Cloudflare?
Custom rules are written by the team to enforce application-specific logic, such as blocking a country or protecting a specific path, and they execute in the order the team arranges them. Managed rules are pre-built, continuously updated rulesets maintained by Cloudflare that protect against known attack classes, and they run in a later phase than custom rules. In practice, teams use managed rulesets as a broad baseline and layer custom rules on top for their specific needs.
How many custom WAF rules can I create on Cloudflare?
The custom rule limit depends on the plan: free plans allow 5, Pro allows 20, and Business allows 100, while Enterprise plans allow substantially more. Because the limit counts all rules in the custom rules phase, teams managing complex configurations can reach the ceiling on lower tiers, which is a common trigger for consolidating or documenting a sprawling rule set.
What is the Cloudflare WAF attack score and how do I use it?
The WAF attack score is a machine-learning detection layer that rates each request on how likely it is to be an attack, catching malicious patterns like SQL injection and XSS that signature rules can miss. It does not block anything by itself; instead, teams reference the score inside a custom rule or rate limiting rule and choose an action for low-scoring traffic. This lets machine-learning detection and signature-based rules work together rather than as separate systems.
How do I manage Cloudflare WAF rules across multiple zones?
On non-Enterprise plans, Cloudflare WAF configuration operates per zone, so rules added to one zone are not automatically applied to others, and keeping many zones consistent is a manual process prone to drift. Enterprise account-level configuration allows deploying rules across multiple zones centrally, and teams on other plans typically maintain consistency through the API, infrastructure-as-code, or a management platform that provides a unified view of rules across every zone.
Christophe Pronier


