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.

Choose 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:

  • IP address (ip.src) IP address: Varies based on whether your traffic is proxied:
    • Proxied: Provides 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.
    • DNS-only: Provides the ECS source address, if available. If not available, then provides the client resolver IP.
  • Load Balancer Region (cf.load_balancer.region) bytes: Provides the region name of the data center processing the request.
  • Load Balancer Name (cf.load_balancer.name) bytes: Provides the name of the load balancer executing these rules.

​​ 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 BuilderFieldDescription
Query Typedns.qry.type
Int

The numeric value of the DNS query type

Example Values:

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

A boolean indicating that the received DNS message was a question

Query Namedns.qry.name
Bytes

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

Query Name Lengthdns.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.