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

Custom rules

Custom load balancing rules let you customize the behavior of your load balancer based on the specific characteristics of a request.

For example, you could create a rule that selects an origin pool based on the URI path of an HTTP request.

​​ More details

You can create Load Balancing rules whenever you create or edit a load balancer in Traffic > Load Balancing.

As with firewall rules, each Load Balancing 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.

When building expressions for Load Balancing rules, refer to Supported fields and operators for definitions and usage.

​​ Availability

By default, non-Enterprise customers have one Load Balancing rule per load balancer hostname. For more rules, upgrade to Enterprise.

​​ Limitations

At the moment, you cannot use load balancing rules with Cloudflare Spectrum.