INTEGRITY Cloudflare Docs

Concepts

The Cloudflare Web Application Firewall (Cloudflare WAF) checks incoming web and API requests and filters undesired traffic based on sets of rules called rulesets. The WAF uses the Rules language, a flexible expression syntax that lets you filter traffic by request properties such as IP address, URL path, headers, and body content.

Rules and rulesets

A rule defines a filter and an action to perform on the incoming requests that match the filter.

A ruleset is an ordered set of rules that you can apply to traffic on the Cloudflare global network. Rules within a ruleset are evaluated in sequence. The first matching rule with a terminating action (such as Block, Challenge, or Redirect) stops evaluation — later rules do not run for that request.

Main components

The Cloudflare WAF includes:

Detection versus mitigation

The two main roles of the Cloudflare WAF are the following:

Available traffic detections

The WAF currently provides the following detections for finding security threats in incoming requests:

To enable traffic detections in the Cloudflare dashboard, go to the Security Settings page.

Go to Settings ↗

Rule execution order

Cloudflare evaluates different types of rules when processing incoming requests. The first rule with a terminating action (such as Block, Managed Challenge, or Redirect) stops all further evaluation. For example, an IP Access rule that blocks a request prevents custom rules from running. The rule execution order is the following:

  1. IP Access rules
  2. Firewall rules (deprecated)
  3. Custom rules
  4. Rate limiting rules
  5. Managed Rules
  6. Cloudflare Rate Limiting (previous version, no longer available)

Rules are evaluated in order. If there is a match for a rule with a terminating action, the rule evaluation will stop and the action will be executed immediately. Rules with a non-terminating action (such as Log) will not prevent subsequent rules from being evaluated and executed. For more information on how rules are evaluated, refer to Rule evaluation in the Ruleset Engine documentation.

For more information on the phases where each WAF feature will execute, refer to WAF phases.

For common interactions between rewrites, IP Access rules, custom rules, and managed rules, refer to Rule phase interactions.