In Cloudflare's HTTP DDoS Attack Protection, how do sensitivity levels, actions and overrides work, and which override wins when several match?
answer
- higher sensitivity, lower threshold
- High is the API value default
- ruleset, tag and rule scope
- first match on expression and sensitivity
basics
~20 sEach rule has a sensitivity level (High by default, then Medium, Low, Essentially Off) and an action; an override changes either for the ruleset, a tag or a rule, the most specific scope wins, and the first override matching expression and sensitivity applies.
solid answer
~40 sSensitivity sets the threshold: *High* (API value `default`) has the lowest threshold, then `medium`, `low` and `eoff` (*Essentially Off*). The override actions are Block (`block`), Managed Challenge (`managed_challenge`), Interactive Challenge (`challenge`) and, on Enterprise, Log (`log`); Connection Close, Force Connection Close and DDoS Dynamic are internal actions you cannot set. An override is an `execute` rule in the `ddos_l7` phase whose `overrides` can target the whole ruleset, a tag such as `generic`, or a rule ID, and tag and rule settings beat ruleset settings. Most zones get one override that applies to all traffic; Enterprise with Advanced DDoS Protection gets up to 10 with custom expressions, evaluated in order, and the first one whose expression and sensitivity both match is applied.
code
json · 28 lines{
"description": "Execute HTTP DDoS Attack Protection managed ruleset in the zone-level phase entry point ruleset",
"rules": [
{
"action": "execute",
"action_parameters": {
"id": "<MANAGED_RULESET_ID>",
"overrides": {
"sensitivity_level": "medium",
"action": "managed_challenge",
"categories": [
{
"category": "generic",
"sensitivity_level": "low"
}
],
"rules": [
{
"id": "<MANAGED_RULESET_RULE_ID>",
"action": "block"
}
]
}
},
"expression": "true"
}
]
}go deeper
Recall the four sensitivity levels with High as the default, and the actions you can set: Block, Managed Challenge, Interactive Challenge and, on Enterprise, Log.
Explain the ruleset, tag and rule scopes, that the more specific scope wins, and the API values default, medium, low and eoff. Know that most zones get one override with the expression true.
Show the ordering trap: the first override matching both expression and sensitivity wins, so Block-at-Low must precede Log-at-High. Mention that zone overrides silence account-level ones.
Treat overrides as shared configuration: one override per zone on most plans means every tweak edits the same object, so decide who may change it and keep account-level policy and zone exceptions from silently replacing each other.
## The two knobs: sensitivity and action Every rule in the **HTTP DDoS Attack Protection** managed ruleset arrives with a default sensitivity level and a default action. An **override** is how a zone changes either one. **Sensitivity level** (API property `sensitivity_level`) moves the threshold at which a rule decides traffic is an attack. A higher sensitivity means a lower threshold, so it fires sooner. | Dashboard value | API value | Effect | |---|---|---| | *High* (the default) | `default` | lowest threshold, most aggressive | | *Medium* | `medium` | higher threshold | | *Low* | `low` | higher still | | *Essentially Off* | `eoff` | exceptionally high threshold; still fires for extreme attacks | **Action** (API property `action`) is what happens to matching requests: - **Block** (`block`) denies the request. - **Managed Challenge** (`managed_challenge`) lets Cloudflare choose a suitable challenge per request. - **Interactive Challenge** (`challenge`) makes the client complete an interactive challenge. - **Log** (`log`) records the match without mitigating, recommended for validating a rule before a stricter action; it is an Enterprise option. - **Connection Close**, **Force Connection Close** and **DDoS Dynamic** appear in analytics but are internal actions: you cannot put them in an override. ## Where overrides live and what they target Overrides are rules in the zone's `ddos_l7` phase entry point ruleset. Because the managed ruleset already runs on every zone, you only create a rule in that phase when you need overrides. The rule uses the `execute` action with the managed ruleset's ID, and its `overrides` object can carry three scopes at once: 1. **Ruleset scope**: a top-level `action` or `sensitivity_level` for every rule. 2. **Tag scope**: `categories` entries such as `botnets`, `unusual-requests`, `generic` or `advanced`. 3. **Rule scope**: `rules` entries naming a managed rule ID. Within one override, **specificity wins**: tag and rule settings take priority over ruleset settings. In the code example, every rule challenges at Medium, `generic` rules drop to Low, and one named rule blocks. ## How many overrides, and in what order The number of overrides depends on the subscription: - **Without Advanced DDoS Protection** (Free to Enterprise): one override, whose expression is always `true`, so it applies to all incoming requests. It can still hold many tag and rule configurations. - **Enterprise with Advanced DDoS Protection**: up to 10 overrides, each with a custom expression built from fields such as `http.request.uri.path`, `http.host`, `ip.src`, `ip.src.asnum` or `http.user_agent`. With several overrides, **order is everything**. They are evaluated in order, and Cloudflare applies the first override that matches *both* its expression and its sensitivity level, then stops. Two consequences: - An override that sets Low sensitivity only matches when traffic crosses the Low threshold. A small attack below it falls through to the next override. - To keep blocking at Low while logging what High would catch, the Block-at-Low override must come **before** the Log-at-High one. Reversed, the Log override matches everything first and the Block override is never reached. An override without an expression that matches also stops evaluation. ## Zone versus account level Overrides can also be created at account level, through the API only, to apply one configuration to many zones, for example lowering a rule's sensitivity for an IP list. If a zone has its own HTTP DDoS overrides, the account-level ones are **not evaluated** for that zone; only the most specific level counts. ## Limits worth remembering - The ruleset cannot be disabled; an override with `"enabled": false` cannot turn its rules off. - Rules tagged `read-only` refuse action and sensitivity overrides. - A saved override takes effect within one or two minutes, which matters during an incident. - Thresholds are per attack fingerprint and unpublished, so tuning is done by stepping sensitivity, not by entering numbers. - A `PUT` to the entry point replaces its rules, so when you add a rule override through the API, keep the ruleset override already there; the get-started guide warns about exactly this. ## Reading the example The example body is the documented zone-level `PUT` to `/zones/{zone_id}/rulesets/phases/ddos_l7/entrypoint`, with the tag set to `generic`. Its single rule has the expression `true`, the only form a zone without Advanced DDoS Protection may use.
- An override sets the whole ruleset to Managed Challenge and the botnets tag to Block; what does a botnets rule do?It blocks. Within one override the more specific configuration wins: tag and rule settings take priority over ruleset settings. Every rule outside that tag uses Managed Challenge, and a rule named individually in the same override would beat both the tag and the ruleset setting.
- A company has an account-level HTTP DDoS override for an IP list, and one zone adds its own override; what changes for that zone?The account-level override stops applying to that zone. When a zone has HTTP DDoS overrides of its own, only the zone-level ones are evaluated, so anything the account rule did must be repeated in the zone's override, or the zone loses it.
- Setting sensitivity to a value called high, above the default, to catch more attacks.
- Putting Force Connection Close or DDoS Dynamic into an override as the action.
- Expecting the strictest action to win when several ordered overrides match.
- Assuming account-level overrides still apply once a zone defines its own.
- Writing a path-scoped override expression on a zone without Advanced DDoS Protection.