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.
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
orX-Real-IP
. - DNS-only: Provides the ECS source address, if available. If not available, then provides the client resolver IP.
- 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
- 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 Builder | Field | Description |
---|---|---|
Query Type | dns.qry.type Int | The numeric value of the DNS query type Example Values:
|
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 |
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.