Skip to content
Load Balancing
Visit Load Balancing on GitHub
Set theme to dark (⇧+D)

Load Balancing rules

Use Load Balancing rules to customize the behavior of your Cloudflare load balancer. For example, create a Load Balancing rule that selects an origin pool based on the URI path of an HTTP request.

You can create Load Balancing rules, using the Create Custom Rule dialog, whenever you create or edit a load balancer in the Traffic app:

Create Custom Rule card in Traffic app

As with Cloudflare 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.

In this example rule, the expression targets requests to example.com that contain /content/video in the URI path. The action marks them for pool selection:

ExpressionAction
http.host eq "www.example.com" and http.request.uri.path contains "/content/video"Pool selection

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

For a walkthrough, see Creating Load Balancing rules.