Seven ways to route traffic
Every strategy runs inside a Cloudflare Worker on your account across 330+ PoPs. Switch strategies anytime with zero-downtime Worker Versions.
Strategy comparison
| Strategy | Mechanism | Failover | Stickiness | Complexity |
|---|---|---|---|---|
| Round Robin | Edge-local cursor | Health-check skip | No | Low |
| Weighted Round Robin | Weighted random | Health-check skip | No | Low |
| IP Hash | Deterministic hash | Health-check skip | Yes (by IP) | Low |
| Cookie Sticky Sessions | Cookie read/set | Re-pins on failure | Yes (eb_lb cookie) | Medium |
| Weighted Sticky Sessions | Weighted + cookie | Re-pins on failure | Yes (eb_lb cookie) | Medium |
| Failover | Retry on failure | Automatic | No | Medium |
| Geographic Steering | Geo lookup | Regional fallback | No | High |
Round Robin
Equal distribution, zero configuration
Each incoming request is sent to the next origin server in the list, cycling through all healthy servers in order. Every server gets an equal share of traffic.
The Worker maintains an edge-local rotating cursor. Request 1 goes to Origin A, Request 2 to Origin B, Request 3 to Origin C, and so on within each Cloudflare data center.
- ✓Origins have identical CPU/RAM capacity
- ✓Serving stateless APIs or static content
- ✓You want the simplest possible setup
- ✓All origins live in the same region
- —Origins have unequal capacity
- —You require session stickiness
Weighted Round Robin
Proportional traffic based on server capacity
Each origin is assigned a numeric weight that determines what share of traffic it receives — matching traffic distribution to your server capacity.
The Worker uses weighted selection across healthy origins based on your configured weights (e.g., 60 / 30 / 10). Distribution converges to the configured ratios over time.
- ✓Origins have different capacities (e.g., 8GB vs 2GB RAM)
- ✓Gradual rollouts (sending 10% traffic to a new node)
- ✓Mixing dedicated and smaller standby servers
- —All origins are identical (use Round Robin)
- —Strict deterministic order is required
IP Hash
Deterministic routing without cookies
The visitor IP address (CF-Connecting-IP) is hashed to map the same client consistently to the same origin server across browsers, mobile apps, and API clients.
The Worker hashes CF-Connecting-IP and maps the result to an active origin index. If an origin fails health checks, traffic redistributes across remaining healthy origins.
- ✓Consistent routing needed without HTTP cookies
- ✓API consumers or mobile apps that ignore cookies
- ✓Origin-local cache warming
- —Large user groups behind a single corporate NAT/VPN IP
- —Strict even load across uneven clients
Failover
Primary-backup with automatic recovery
Routes traffic to your primary origin first. On 5xx response, timeout, or connection failure, the Worker automatically retries the next backup origin in priority order.
Requests target the highest-priority healthy origin. If it fails or fails background health probes, traffic shifts to standby backups and automatically returns when the primary recovers.
- ✓Primary production server with a hot standby backup
- ✓Active-passive disaster recovery without slow DNS TTLs
- ✓Automatic failback when primary recovers
- —You want active-active load sharing across all origins simultaneously
Geographic Steering
Location-aware routing by colo, country, or continent
Uses Cloudflare edge request metadata (data center colo, country, continent) to route visitors to the nearest regional origin.
The Worker checks colo match first, then country, then continent against your origin geo tags. If no regional match is healthy, it falls back to round-robin across available origins.
- ✓Multi-region origins (US, EU, APAC)
- ✓Data residency / GDPR regional routing
- ✓Minimizing round-trip latency for global users
- —All origins live in a single data center
Ready to deploy your strategy?
All 7 routing strategies are included on the Free tier — up to 5 load balancers with no credit card required.