Create and manage Load Balancing rules in the Custom Rules page, which is part of the Create/Edit Load Balancer workflow found in Traffic in the dashboard.
- Understand whether Cloudflare proxies your traffic: Depending on the proxy status of your traffic, you may have access to different fields for your load balancing rules. For more details, refer to Supported fields and expressions.
-
In the Cloudflare dashboard, go to the Load Balancing page.
Go to Load Balancing ↗ -
Edit an existing load balancer or create a new load balancer.
-
From the Load Balancer workflow, select Custom Rules.
-
Select Create Custom Rule.
-
In the Field drop-down list, choose an HTTP property. For more details, refer to Supported fields.
-
In the Operator drop-down list, choose an operator. For more details, refer to Operators.
-
Enter the value to match. When the field is an ordered list, Value is a drop-down list. Otherwise, Value is a text input.
-
(Optional) To create a compound expression using logical operators, select And or Or.
-
For an action, choose Respond with fixed response or Override and enter additional details. For a full list of actions, refer to Actions.
-
(Optional) Select Add another override.
-
After you create your rule, select Save and Deploy or Save as Draft.
-
Select Next and review your changes.
-
Select Save to confirm.
If you want to host example.com/blog separately from your main website, for example, use the following custom rule.
When incoming requests match:
| Field | Operator | Value |
|---|---|---|
| URI Path | contains | /blog |
Then:
| Action | Options | Value |
|---|---|---|
| Overrides | Pools | <BLOG_SERVER> |