Load Balancing: Monitors, Pools, Traffic Steering, and Failover
How Cloudflare Load Balancing uses monitors, pools, and steering to spread traffic, fail over on health checks, and choose proxied versus DNS-only modes.
This page summarizes Cloudflare Load Balancing documentation: an account add-on that distributes traffic across endpoints with active health monitoring, traffic steering, and automatic failover. The same product covers global traffic management (steering users toward a region) and distribution among servers inside that region, often through one configuration.
Load Balancing components: what monitors, pools, and load balancers do
Section titled “Load Balancing components: what monitors, pools, and load balancers do”Cloudflare’s model has three linked pieces: health monitors classify endpoints as healthy or unhealthy; pools group endpoints and attach monitors and endpoint-level steering; load balancers choose pools using traffic steering and optional custom rules.
At it’s most basic, load balancing is made up of three components:
Pools: Which contain one or more endpoints. Endpoints: Which respond to individual requests. A load balancer: Which decides which traffic goes to each pool.
— Cloudflare, Components of a load balancer
A load balancer distributes traffic among pools according to pool health and traffic steering policies. Each load balancer is identified by its DNS hostname (lb.example.com, dev.example.com, etc.) or IP address.
— Cloudflare, Load balancers
Pools and monitors are account-level; load balancers belong to a zone (hostname or private IP). Several load balancers can share the same pools and monitors, which suits different failover order per hostname.
| Component | Scope | Role |
|---|---|---|
| Monitor | Account | Probes endpoints (HTTP/S, SMTP, etc.) on an interval |
| Pool | Account | Endpoints, weights, minimum_origins, attached monitor |
| Load balancer | Zone | Hostname or private IP, default/fallback pools, steering, proxy mode |
Endpoints must be reachable on port 80 or 443 for typical HTTP load balancing, unless you front the service with a tunnel or port mapping. Address types include public IP, proxied hostname, non-Cloudflare hostname, or private IP with a virtual network.
When to use Load Balancing instead of round-robin DNS
Section titled “When to use Load Balancing instead of round-robin DNS”To randomly distribute traffic across multiple servers, set up multiple DNS A or AAAA records for the same hostname.
Use this setup for simple, round-robin load balancing ↗︎. If you need more fine-grained control over traffic distribution — including automatic failover, intelligent routing, and more — set up our add-on load balancing service.
— Cloudflare, Round-robin DNS
The Terraform load balancing tutorial shows the gap: multiple proxied A records give unpredictable distribution, with no health checks, no geographic steering, and unpredictable distribution patterns. Product Load Balancing adds monitors, pool health, steering, and failover.
If a single origin server handles all your traffic, any failure or overload takes your application offline. Cloudflare’s load balancing distributes traffic across multiple origins with health checks and automatic failover.
— Cloudflare, Balance traffic across origins
Enable Load Balancing on the account
Section titled “Enable Load Balancing on the account”Load balancing is an add-on for your account, meaning your account needs a billing profile.
— Cloudflare, Enable
If Load Balancing is not enabled, configuration fails; see Common error codes. Enterprise accounts can preview the product as a non-contract service with full access and without certain metered fees, per Cloudflare Load Balancing.
Plan hostname and TLS before cutover:
Before setting up anything related to your load balancer, make sure you test that production hostnames meet the following criteria:
Based on the priority order of DNS records, they will receive the intended amount of traffic. Each hostname is covered by an SSL/TLS certificate.
— Cloudflare, Hostname preparation
Proxy status: Layer 7 proxied versus DNS-only load balancing
Section titled “Proxy status: Layer 7 proxied versus DNS-only load balancing”You can balance at different stack levels; the usual choice is Layer 7 (HTTP/HTTPS) with the orange cloud (proxied).
Layer 7 load balancers direct traffic to specific endpoints based on information present in each HTTP/HTTPS request (HTTP headers, URI, cookies, type of data, etc.).
— Cloudflare, Proxy status
Proxied (orange cloud) traffic hits Cloudflare’s edge; the load balancer step runs late in the L7 path, then traffic goes to the chosen endpoint.
In the layer 7 stack, load balancing can further improve the performance, reliability, and reachability of an organization’s public-facing web assets.
— Cloudflare, Load Balancing Reference Architecture
Compared with DNS-only, proxied load balancing hides origin IPs, fails over faster (less DNS cache stickiness), integrates with WAF, caching, and Workers, and supports richer session affinity and Private Network Load Balancing—see Types of load balancers.
DNS-only (gray cloud) answers DNS with healthy endpoint IPs; the client connects directly. That suits non-HTTP traffic at the DNS layer and MX/SRV balancing (Enterprise), which must be unproxied—see Additional DNS records. DNS-only load balancers use a short TTL (30 seconds) so clients re-query as health changes.
| Model | Proxied | Typical traffic | Hides origin IP |
|---|---|---|---|
| Layer 7 HTTP(S) | Yes | HTTP(S), WebSockets | Yes |
| DNS-only | No | Any IP protocol after DNS | No |
| Spectrum (L4) | Yes | TCP/UDP | Depends on setup |
Public versus Private load balancers
Section titled “Public versus Private load balancers”Public Load Balancers are designed to handle traffic from the public Internet. When deployed, they automatically receive a hostname, making them immediately accessible.
Private Load Balancers, in contrast, are meant for internal use within private networks. They do not automatically receive a hostname, but one can be assigned via Gateway Firewall Policies or through an internal DNS system. Private Load Balancers only accept traffic over a private network on-ramp, such as the Cloudflare One Client or Cloudflare WAN.
— Cloudflare, Load balancers
Private Network Load Balancing balances traffic inside a data center or between private apps, using public IPs, virtual IPs, or private IPs. Private IPs usually need a Cloudflare Tunnel with a virtual network, or Cloudflare WAN off-ramps.
LB DNS records: how a load balancer hostname replaces other records
Section titled “LB DNS records: how a load balancer hostname replaces other records”Creating a public load balancer adds an LB record for the hostname:
When you create a load balancer, Cloudflare automatically creates an LB DNS record for the specified Hostname. This functionality allows you to use a hostname with or without an existing DNS record. Private load balancers do not receive an automatic DNS record.
— Cloudflare, DNS records
When you create the www.example.com load balancer below, it will supersede the two www DNS records that you previously defined.
— Cloudflare, Improve performance (Terraform tutorial)
More specific names win over wildcards; an active custom hostname on Cloudflare for SaaS can override the LB record—scenarios in DNS records for load balancing. Disabling a load balancer falls back to existing A/AAAA/CNAME records if present; otherwise the hostname fails.
Supported record types: A, AAAA, CNAME on non-Enterprise plans; MX and SRV on Enterprise—Additional DNS records.
Health monitors: how endpoints become unhealthy
Section titled “Health monitors: how endpoints become unhealthy”Monitors probe from multiple regions. The Terraform example uses HTTPS GET on /health, 2xx, five-second timeout, 60-second interval, and consecutive failures mark an origin unhealthy—Improve performance.
Monitor your endpoints at configurable intervals and across multiple data centers to look for specific status codes, response text, and timeouts.
— Cloudflare, Cloudflare Load Balancing
For Cloudflare Pages as an endpoint, set Add host header to the pages.dev (or custom) hostname on both the pool endpoint and monitor; otherwise monitors and visitors can hit Error 1000—Use Pages as an origin for Load Balancing and known issues.
Traffic steering, fallback pools, and Adaptive Routing
Section titled “Traffic steering, fallback pools, and Adaptive Routing”On the load balancer you set default pools, a fallback pool, and traffic steering (geo, latency, random weights via API, or “Off” for strict pool order = active-passive). Adaptive Routing includes Failover across pools—Adaptive routing.
Geographic steering - Route users to the nearest or best-performing origin based on latency or geography
— Cloudflare, Balance traffic across origins
Custom Rules override default pool selection using request expressions (for example URI path). Non-Enterprise accounts get one rule per load balancer hostname unless upgraded—Custom load balancing rules. Save both the rule and the full load balancer when deploying—Create custom rules.
Create a load balancer: dashboard workflow and API
Section titled “Create a load balancer: dashboard workflow and API”The Quickstart and Create a load balancer workflows: choose Public or Private → hostname and proxy mode → pools and fallback order → review pool monitors → traffic steering → custom rules → Save and Deploy or Save as Draft.
Start on a test hostname first—Create load balancer on test domain.
Sharing one configuration across hostnames: create the load balancer on lb.example.com, then CNAME other names to it (full DNS setup only)—Account-level load balancing and Manage load balancers. For different steering per zone, use separate load balancers that reuse account pools.
Zone-scoped API example (abbreviated) from Create load balancer on test domain:
curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/load_balancers" \ --request POST \ --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ --json '{ "name": "lb.example.com", "proxied": true, "default_pools": ["<pool-id-1>", "<pool-id-2>"], "fallback_pool": "<pool-id-1>", "steering_policy": "random_steering" }'Terraform resources: cloudflare_load_balancer_monitor, cloudflare_load_balancer_pool, cloudflare_load_balancer—Terraform tutorial.
Cloudflare Tunnel and Load Balancing together
Section titled “Cloudflare Tunnel and Load Balancing together”Tunnel endpoints use <UUID>.cfargotunnel.com as the pool address, not the customer app CNAME alone:
Load Balancer does not support directly adding app.example.com as an endpoint if the service is behind Cloudflare Tunnel.
— Cloudflare, Public load balancers
Set the endpoint Host header to the published application hostname (for example app.example.com). One pool cannot list the same tunnel UUID twice—Tunnel routing. For HA by region, many setups use one tunnel per data center and one pool per tunnel—Tunnel availability and failover.
Multiple zones and planning patterns
Section titled “Multiple zones and planning patterns”| Goal | Pattern |
|---|---|
| Same steering for many hostnames | LB on lb.example.com + CNAMEs |
| Different failover order per domain | Separate LBs, shared pools/monitors |
| URL-based pool choice | Load Balancing custom rules |
| Session stickiness | Session Affinity on proxied L7 LBs |
| DNS stickiness without proxy | DNS persistence |
Further options (Spectrum, load shedding, maintenance) are listed under Additional configuration and Next steps.
Common mistakes
Section titled “Common mistakes”- Enabling the load balancer before pools show Healthy in the dashboard—Use Pages as an origin.
- Omitting host header for Pages, tunnel, or multi-hostname tunnel pools.
- Expecting private hostname-only tunnel routes to work with Load Balancing (use replicas or IP/CIDR routes)—Tunnel availability and failover.
- Using the same private IP twice in one pool even with different virtual networks—Set up Private Network Load Balancing for Public traffic to Tunnel.
- Spectrum LB hostnames colliding with the Spectrum app hostname; Session Affinity and failover across pools are not supported with Spectrum—Spectrum.
- Creating a load balancer without Enable Load Balancing on the account—Common error codes.
How to check this on your site
Section titled “How to check this on your site”-
Confirm Enable Load Balancing is active and open Traffic → Load Balancing in the Cloudflare dashboard to review monitors, pools, and load balancer health—as in the Terraform tutorial verification.
-
Under Pools, expand each pool and confirm endpoints are Healthy after monitor configuration (especially host headers for Pages or tunnel origins)—Use Pages as an origin for Load Balancing.
-
Send repeated requests to the load balancer hostname (or run the tutorial
curlloop) and confirm distribution or failover matches your steering policy—Improve performance and Send traffic and review analytics. -
In DNS → Records, confirm the LB record precedence for your hostname matches DNS records for load balancing before routing production traffic—Route production traffic.
-
You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page does not match your configuration or the linked Cloudflare docs, write to yimasynthetic@gmail.com with the page URL and the exact sentence you think is wrong or unclear.