Skip to content
Load Balancing
Visit Load Balancing on GitHub
Set theme to dark (⇧+D)

Supported fields and operators

Fields

Load Balancing expressions support these fields:

FieldName in Expression BuilderDescription
http.request.version
Number
HTTP version

The version of the HTTP protocol used. Use this field when you require different checks for different versions.

Example Values:

  • HTTP/1.1
  • HTTP/3

ip.src
IP address
IP address

The client TCP IP address, which may be adjusted to reflect the actual address of the client by using, for example, HTTP headers such asX-Forwarded-For or X-Real-IP.

Example value:
93.184.216.34

http.request.uri
String
URI

The absolute URI of the request.

Example value:
/articles/index?section=539061&expand=comments

http.request.uri.path
String
URI path

The URI path of the request.

Example value:
/articles/index

http.request.uri.query
String
URI query string

The entire query string for the request, without the ? delimiter.

Example value:
section=539061&expand=comments


Operators

Overview

Comparison operators specify how values defined in an expression must relate to the actual HTTP request value for the expression to return true.

Logical operators combine two expressions to form a compound expression and use order of precedence to determine how an expression is evaluated.

Load Balancing expressions also support grouping symbols, which allow you to organize expressions, enforce operator precedence, and nest expressions. For examples and usage, see Grouping symbols in the Firewall Rules documentation.

Comparison operators

Comparison operators return true when a value from an HTTP request matches a value defined in an expression.

This is the general pattern for using comparison operators:

<field> <comparison operator> <value>

Load Balancing expressions support these comparison operators:

NameOperator NotationSupported Data TypesExample (operator in bold)
StringIPRules list
Equaleqhttp.request.uri.path eq "/articles/2008/"
Not equalneip.src ne 93.184.216.0
Exactly
contains
containshttp.request.uri.path contains "/articles/"
Matches
RE2 regex
matcheshttp.request.uri.path matches "^/articles/200[7-8]/$"
Value is in
a set of values
inip.src in { 93.184.216.0 93.184.216.1 }

Logical operators

Logical operators combine two or more expressions into a single compound expression. A compound expression has this general syntax:

<expression> <logical operator> <expression>

Each logical operator has an order of precedence. The order of precedence (along with grouping symbols) determines the order in which Cloudflare evaluates logical operators in an expression. The not operator ranks first in order of precedence. For more on how Cloudflare evaluates logical operators in expressions, see Order of precedence in the Firewall Rules documentation.

Load Balancing expressions support these logical operators:

NameEnglish
Notation
C-like
Notation
ExampleOrder of Precedence
Logical NOTnot!not ( http.host eq "www.cloudflare.com" and ip.src in 93.184.216.0/24 )1
Logical ANDand&&http.host eq "www.cloudflare.com" and ip.src in 93.184.216.0/242
Logical XOR
(exclusive OR)
xor^^http.host eq "www.cloudflare.com" xor ip.src in 93.184.216.0/243
Logical ORor||http.host eq "www.cloudflare.com" or ip.src in 93.184.216.0/244