Custom load balancing rules let you customize the behavior of your load balancer based on the characteristics of a request.
For example, you can use URL-based routing, or create a rule that selects a pool based on the URI path of an HTTP request.
As with WAF custom rules, each load balancing custom rule is a combination of two elements: an expression and an action. Expressions define the criteria for an HTTP request to trigger an action. The action tells Cloudflare how to handle the request.
You can create Load Balancing rules whenever you create or edit a load balancer in Load Balancing.
When building expressions for Load Balancing rules, refer to Supported fields and operators for definitions and usage.
By default, non-Enterprise customers have one Load Balancing rule per load balancer hostname. For more rules, upgrade to Enterprise ↗︎.
At the moment, you cannot use Load Balancing rules with Cloudflare Spectrum.
Custom rules can override Geo steering pool mappings for matched requests. Specify different region, country, or data center pools in the rule. Changing only the steering policy does not disable Geo steering. Cloudflare still resolves pools from the configured topology before applying that policy.
Custom rules do work alongside pool sets. Cloudflare evaluates pool sets first, then applies custom rule overrides on top of the result. A pool set that returns a fixed response is the complete response, so custom rules are not evaluated for that request.