Documentation Schedule a pilot

Web Application Firewall (WAF)

The Cloudflare WAF evaluates proxied HTTP requests against custom rules, rate limiting rules and Cloudflare managed rulesets before they are forwarded to the origin server. This page documents the evaluation model, configuration objects, documented limits, plan availability and a deployment procedure.

Document control

Dana, technical writer at Integrity
Dana
Technical writer, Integrity Czech Republic s.r.o.

Document control. Vendor: Cloudflare, Inc. Document owner: Dana, technical writer, Integrity Czech Republic s.r.o. Last reviewed: 2026-08-31. Content snapshot of the referenced Cloudflare documentation: 2026-08-28. Figures in this document were verified against the sources listed under References on the dates shown there; Cloudflare changes limits and packaging without notice, so verify at the source before you design against a value.

Overview

A web application firewall inspects HTTP requests before an application processes them and applies rules that allow, log, challenge, redirect or block. It is a filtering control that operates alongside patching rather than in place of it: it reduces exposure to known exploit classes and to automated scanning during the interval between disclosure and deployment of a fix.

The Cloudflare WAF is evaluated in Cloudflare data centres that proxy traffic for a zone. Cloudflare states that its network operates in 348 cities (https://www.cloudflare.com/network/, retrieved 2026-08-28). Only traffic that is proxied through Cloudflare is inspected. A DNS-only record, a hostname resolved outside the zone, or a client connecting directly to the origin IP address bypasses the WAF.

Rule content in the Cloudflare managed rulesets is maintained by Cloudflare and changes without a customer deployment step. Cloudflare does not publish a contractual update interval for managed rule content.

Cloudflare does not publish a measured latency figure for rule evaluation. If latency is a design constraint, measure it against your own configuration.

Architecture

A request to a proxied hostname terminates TLS at the Cloudflare data centre selected by anycast routing. The request then passes through the ruleset engine, which evaluates rules grouped into ordered phases. The security-relevant phases execute in this order:

  1. URL normalisation and request sanitisation.
  2. http_request_firewall_custom: zone and account custom rules.
  3. http_ratelimit: rate limiting rules.
  4. http_request_firewall_managed: Cloudflare Managed Ruleset, Cloudflare OWASP Core Ruleset and other managed rulesets deployed to the zone.

Within a phase, rules are evaluated in configured order. A terminating action stops evaluation of the remaining rules for that request. A non-terminating action allows evaluation to continue. The full phase list, including transform, redirect and cache phases, is documented in the phases reference cited below.

Detections are separate from rules. Attack score, leaked credentials detection, malicious uploads scanning and sensitive data detection compute values during request processing and expose them as fields. They do not block on their own; a rule must reference the field and specify an action. This separation is why enabling a detection changes no traffic until a rule consumes it.

The Cloudflare Managed Ruleset applies signature and heuristic detections curated by Cloudflare. The OWASP Core Ruleset operates differently: it evaluates a request against generic attack patterns, accumulates a score, and triggers when the score crosses a configured threshold at a configured paranoia level. The two rulesets are tuned independently.

Capabilities

CapabilityBehaviourPlan or tierSource
Cloudflare Managed RulesetVendor-curated signature and heuristic rules for common exploit classes and published CVEs.Pro and above; a reduced Cloudflare Free Managed Ruleset is deployed on Free.WAF managed rules
Cloudflare OWASP Core RulesetAnomaly scoring against generic attack patterns, with configurable paranoia level and score threshold.Pro and above.OWASP Core Ruleset
Custom rulesRules written as expressions over request fields, with a configurable action.All plans; quotas and regular expression support differ.Custom rules
Rate limiting rulesCounts matching requests per configured characteristic over a period and applies an action when a threshold is exceeded.All plans; rule count, period and characteristics differ.Rate limiting rules
Leaked credentials detectionFlags authentication requests using username and password pairs seen in public breach data; exposes fields for rules.Detection available across plans with reduced field availability outside Enterprise; verify at source.Leaked credentials detection
Attack scoreMachine-learning score expressing how closely a request resembles known attack payloads; exposed as rule fields.Business exposes the global attack score; Enterprise exposes the per-class scores.Attack score
Malicious uploads and sensitive data detectionScans uploaded content and response bodies and exposes match fields for rules.Enterprise, as add-on entitlements.WAF detections
Security Events and analyticsPer-rule match visibility, filtering and sampling for review and tuning.All plans; sampling rate and retention differ by plan.Security Events

Configuration model

WAF configuration consists of rulesets deployed to phases. A rule has an expression, an action, an order and optional action parameters. Expressions are written in the Cloudflare Rules language over typed fields such as http.request.uri.path, http.request.headers, ip.src.country, ip.src.asnum, cf.bot_management.score and cf.waf.score. Field availability is not uniform across plans; bot and attack score fields require the corresponding entitlement.

Actions available in the firewall phases are Block, Managed Challenge, Interactive Challenge, JS Challenge, Redirect, Serve Error, Skip, Execute and Log. Managed ruleset behaviour is adjusted with overrides rather than by editing vendor rules: a ruleset-level override changes the action or status for the whole ruleset, a tag-level override changes a group of rules, and a rule-level override changes one rule. Exceptions, expressed as skip rules, remove specific traffic from managed ruleset evaluation without disabling rules globally.

The Log action is documented as available on Enterprise plans only (Rules language actions, retrieved 2026-08-28). Any rollout procedure that depends on a log-only enforcement mode is Enterprise-only. The Deployment section below states the alternative for other plans.

For the OWASP Core Ruleset, two settings determine behaviour: the paranoia level, which selects how many rules participate in scoring, and the score threshold, which sets the anomaly score at which the ruleset acts. Raising the paranoia level increases both detection and false-positive rate.

Configuration is manageable through the dashboard, the Rulesets API and the Cloudflare Terraform provider. Rule order and ruleset deployment order are part of the configuration and should be held in version control when rules are managed as code.

Limits and constraints

The values below were verified against Cloudflare documentation on 2026-08-31 and change without notice. Verify at the source before designing against them: custom rules, rate limiting rules and rules language actions.

ConstraintFreeProBusinessEnterprise
Custom rules per zone5201001,000
Custom rulesets per zone12510
Regular expressions in custom rulesNot availableNot availableAvailableAvailable
Rate limiting rules per zone125100
Rate limiting counting period10 sUp to 1 minUp to 10 minUp to 65,535 s
Rate limiting mitigation timeout10 sUp to 1 hourUp to 1 dayUp to 1 day
Rate limiting counting characteristicsIPIPIP, IP with NAT supportIP, IP with NAT support, and additional characteristics including query, host, headers, cookie, ASN, country, path, JA3 and JA4 fingerprint, JSON field value, body and form input value
Log actionNot availableNot availableNot availableAvailable
Account-level custom rulesetsNot availableNot availableNot availableAvailable

The counting characteristics available on Pro are the same as on Free. A rate limiting rule that counts on anything other than the source address requires Business or Enterprise, which is a frequent cause of a rule designed on one plan failing to deploy on another.

Further constraints that apply regardless of plan:

Plan availability

PlanManaged rule coverageNotable additions
FreeCloudflare Free Managed Ruleset, a reduced set targeting high-impact vulnerabilities.Custom rules and one rate limiting rule.
ProCloudflare Managed Ruleset and Cloudflare OWASP Core Ruleset.Higher rule quotas and longer rate limiting periods.
BusinessAs Pro.Regular expressions in custom rules, global attack score field, higher quotas.
EnterpriseAs Pro, plus additional managed rulesets.Log action, per-class attack scores, advanced rate limiting, account-level rulesets, sensitive data and malicious upload detections, Logpush.

Accurate as of 2026-08-28 against Cloudflare public documentation. Packaging changes without notice. Confirm current entitlements at https://developers.cloudflare.com/waf/ and https://www.cloudflare.com/plans/ before committing to an architecture.

Deployment

Prerequisites. Complete the following before changing any rule:

Staged validation. Choose one of the following, depending on entitlement:

  1. On Enterprise, deploy the managed rulesets with a ruleset-level override setting the action to Log. Collect matches in Security Events for a defined observation window covering at least one full business cycle.
  2. On Free, Pro or Business, where Log is unavailable, use a non-production zone or a dedicated hostname that receives representative traffic, or scope enforcement with an expression that limits the managed rulesets to a small traffic slice such as a single path prefix or a test cookie. Review Security Events for that slice, then widen the expression in stages.

Configuration. Apply changes in this order:

  1. Deploy the Cloudflare Managed Ruleset in blocking mode with the exceptions identified during validation.
  2. Deploy the OWASP Core Ruleset at a low paranoia level and a permissive score threshold. Tighten in steps, re-observing after each step.
  3. Add custom rules for application-specific paths: administrative interfaces, authentication endpoints, upload handlers and internal APIs.
  4. Add rate limiting rules to authentication, password reset, checkout and expensive API endpoints, with thresholds derived from observed traffic rather than from defaults.
  5. Scope exceptions as narrowly as the expression language allows. Prefer a path plus method plus rule ID exception over disabling a rule for the zone.

Cutover. Enable enforcement during a window in which application owners are available. Change one ruleset at a time so that a regression can be attributed. Keep the previous configuration export accessible for the duration of the window.

Verification. Confirm each of the following before closing the window:

Rollback. To reverse the change, re-apply the exported configuration through the API or Terraform, or set a ruleset-level override that disables the ruleset. Record the rule IDs involved in any incident before rolling back, so that tuning can resume from evidence.

Operational considerations

Tune from evidence. Every blocked request carries a Ray ID; the corresponding Security Events entry identifies the ruleset, rule ID and matched field. Support processes should capture the Ray ID from the user, because it is the only reliable key back to the decision.

Analytics sampling and retention differ by plan. On lower plans a false positive that is not investigated promptly may no longer be visible. Where Enterprise Logpush is available, forward firewall events to the SIEM and retain them according to your own policy rather than relying on dashboard retention.

Managed rule content changes on Cloudflare's schedule. New rules can begin matching traffic that previously passed. Configure alerting on Security Events volume so that a change in match rate is noticed, and review new managed rules after they are announced in the Cloudflare changelog.

Rate limiting rules interact with shared client addresses. Traffic behind carrier-grade NAT, corporate proxies or a single mobile gateway can exceed a per-IP threshold without abuse. Where the plan permits additional counting characteristics, count on a session identifier or a header rather than on the source address alone.

Failure modes to plan for: a managed rule update causing new false positives, an exception that is broader than intended silently disabling protection, and an origin that remains reachable directly and therefore unprotected regardless of rule configuration.

Known caveats

Interoperability

The WAF shares the ruleset engine and the Rules language with rate limiting rules, transform rules, redirect rules, cache rules and configuration rules. Rules in different phases can therefore reference the same fields, and phase order determines which runs first.

Bot Management exposes cf.bot_management.score and related fields that WAF custom rules can reference, which is the supported way to combine bot classification with exploit filtering in a single decision.

Turnstile can issue pre-clearance for a session so that a visitor already verified by a widget is not challenged again by WAF rules on a proxied zone.

Workers execute after the security phases in the Cloudflare request pipeline, so a request blocked by the WAF does not reach a Worker. The documented traffic sequence should be consulted when a Worker and a WAF rule appear to conflict.

API Shield adds schema validation, mTLS client certificate enforcement and endpoint discovery for API traffic, and composes with WAF rules on the same hostnames.

FAQ

Does the WAF inspect request bodies? Yes, up to a documented maximum inspected size, and the fields available for body inspection depend on plan and on content type. Content beyond the inspected size is forwarded without body-based evaluation.

Do WAF rules apply to API traffic? Yes. Rules are evaluated on any proxied HTTP request, including JSON APIs and machine-to-machine endpoints. Challenge actions cannot be solved by a non-browser client, so API paths should use Block or rate limiting rather than a challenge.

How is a false positive traced? Capture the Ray ID from the affected response, locate the event in Security Events, and read the ruleset and rule ID from the entry. Scope an exception to that rule ID, path and method.

References

Content snapshot: 2026-08-28.

Changelog

DateChangeAuthor
2026-08-31Rewritten as a technical reference. Added limits and plan availability tables with sources.Integrity documentation team
2026-08-28Initial publication.Integrity documentation team

Request your free pilot

Schedule a pilot