skip to content

DDoS Mitigation Tuning

Always-on DDoS managed rulesets mitigate network and HTTP floods, tuned by sensitivity level and action. Interviewers ask how to stop a false positive and when Under Attack mode helps.

on this pageshow

explore

questions

6

In Cloudflare's HTTP DDoS Attack Protection, how do sensitivity levels, actions and overrides work, and which override wins when several match?

level: middleimportance: must knowfreq 40%

answer

  1. higher sensitivity, lower threshold
  2. High is the API value default
  3. ruleset, tag and rule scope
  4. first match on expression and sensitivity

basics

~20 s

Each 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 s

Sensitivity 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
json
{
  "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

for a junior

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.

for a middle

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.

for a senior

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.

for a principal

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.
open as a page

When does turning on Cloudflare's Under Attack mode help during a layer-7 attack, and what does it cost real users and API clients?

level: middleimportance: must knowfreq 44%

basics

~20 s

Under Attack mode puts a Managed Challenge page before every matching request, stopping floods that slip under the DDoS rules, but it breaks API, mobile and fetch clients; use it as a last resort, scoped by a Configuration Rule.

open as a page

In Cloudflare, what do the two DDoS Attack Protection managed rulesets cover, and why can a team tune them but never switch them off?

level: juniorimportance: should knowfreq 38%

basics

~20 s

HTTP DDoS Attack Protection covers layer-7 floods and Network-layer DDoS Attack Protection covers layer-3/4 floods; both are always on and unmetered on every plan, and a team can only override their action and sensitivity, never remove them.

open as a page

During a real layer-7 flood, Cloudflare's HTTP DDoS Attack Protection is mitigating yet the origin still falls over; how do you tighten the response?

level: seniorimportance: should knowfreq 26%

basics

~20 s

Find the rule and the softer action it applied, override that rule to Block, undo any earlier override that lowered sensitivity, and if the flood stays under the rules' thresholds add Under Attack mode, rate limits and custom rules.

open as a page

With Cloudflare's HTTP DDoS Attack Protection, a ticketing site's legitimate on-sale rush was mitigated as a flood; how do you confirm it and fix it without weakening the whole zone?

level: seniorimportance: should knowfreq 34%

basics

~20 s

Filter security events by Service equals HTTP DDoS to find the rule that fired and confirm the traffic was real buyers, then lower only that rule's sensitivity one step at a time, path-scoped only with Advanced DDoS Protection.

open as a page

How does Cloudflare's Adaptive DDoS Protection build a zone's traffic baseline, and which of its rules do zones on every plan get?

level: middleimportance: nice to knowfreq 18%

basics

~20 s

Adaptive DDoS Protection profiles each zone's daily peak rates over the past seven days at the 95th percentile, then flags traffic that deviates; every plan gets the origin-errors rule, while the location and user-agent rules need Enterprise with Advanced DDoS Protection.

open as a page