Skip to content
Cloudflare Docs

Override expressions

Set an override expression for the Network-layer DDoS Attack Protection managed ruleset to define a specific scope for sensitivity level or action adjustments. For example, you can set different sensitivity levels for different destination IP addresses or ports: a medium sensitivity level for destination IP address A and a low sensitivity level for destination IP address B.

Available expression fields

You can use the following fields in override expressions:

  • ip.src
  • ip.dst
  • ip.proto.num
  • ip.len
  • ip.ttl
  • tcp.srcport
  • tcp.dstport
  • tcp.flags
  • tcp.flags.ack
  • tcp.flags.fin
  • tcp.flags.push
  • tcp.flags.reset
  • tcp.flags.syn
  • tcp.flags.urg
  • udp.srcport
  • udp.dstport

Refer to the Fields reference in the Rules language documentation for more information.

Important remarks

  • Each expression is limited to 4,000 characters, which means you can enter approximately a maximum of 200 IP addresses in a single expression. However, you can enter IP addresses in CIDR format, which allows you to include a larger number of IP addresses. For example, you can use 192.0.0.0/24 to match IP addresses from 192.0.0.0 to 192.0.0.255. Rather than being applied when attacks are detected, the override is applied to the mitigation rule that is created to block malicious packets. This means the override will only take effect if the attack fingerprint generated for mitigation includes the specific fields referenced in your override expression.

You may create an override to allowlist certain source IP addresses. However, since DDoS attacks are typically distributed across many different source IPs, the attack fingerprint may not include source IP addresses as a distinguishing characteristic. In such cases, the override is not be applied.


For example, if you have an expression matching packets with a specific source IP address and the override sets the sensitivity level to low, this override will only lower the sensitivity level for traffic that comes directly from that source IP address. If the DDoS protection system detects an attack coming from many source IP addresses targeted at a single destination IP and port, the generated fingerprint will only match the common criteria of the attack which, in this example, does not include the source IP address. The system will trigger the required mitigation actions at the default high sensitivity level because the traffic did not come from the user-provided source IP address. Therefore, traffic from the source IP in the override expression may still be blocked because the fingerprint only contains the destination IP address and port of the attack.