Cloudflare Docs
Load-Balancing
Visit Load Balancing on GitHub
Set theme to dark (⇧+D)

Supported fields and operators

The fields available for load balancing rules depend on whether Cloudflare proxies the traffic going through your load balancer.

If you use the wrong type of fields, you might see unexpected behavior from load balancing rules. For best results, always use the fields associated with your traffic’s proxy status.

select load balancer fields based on the proxy status header

Fields supported regardless of proxy

Regardless of whether your traffic is proxied, you have access to the following fields:

Name in Expression Builder Field Description
IP address ip.src
IP address

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

Example value:
192.0.2.1

Load Balancer Region cf.load_balancer.region
bytes

The region name of the data center processing the request.

Load Balancer Name cf.load_balancer.name
bytes

The name of the load balancer executing these rules.

Example value:
lb.example.com

Proxied traffic

If your traffic is proxied, you have access to all the fields listed under Proxied Only and Both , such as:

  • Request Method
  • URI
  • Timestamp
  • Header

For the most up to date list of these fields, create a load balancing rule in the UI.

For more details about the field type or properties, refer to the Rules language documentation .

Unproxied traffic

If your traffic is not proxied through Cloudflare, you have access to all the fields listed under Unproxied only and Both .

Cloudflare Load Balancers support the following unproxied fields:

Name in Expression Builder Field Description
Query Type dns.qry.type
Int

The numeric value of the DNS query type

Example Values:

  • 1 (A record)
  • 28 (AAAA record)
Question dns.qry.typ
boolean

A boolean indicating that the received DNS message was a question

Query Name dns.qry.name
Bytes

The byte of the query name asked, such as example.com

Query Name Length dns.qry.name.len
Int

The length in bytes of the query name.


Operators and grouping symbols

  • 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.

  • Grouping symbols allow you to organize expressions, enforce operator precedence, and nest expressions.

For examples and usage, refer to Operators and grouping symbols in the Rules language documentation.