Hash
Hash steering guides Cloudflare to send requests to endpoints based on a combination of endpoint weights and previous requests from that IP address. Ensures requests from the same IP address will hit the same endpoint, but actual traffic distribution may differ from endpoint weights.
Hash Steering relies on the x-forwarded-for
header to determine the originating IP address of a request. However, when a Cloudflare Worker is used in front of a load balancer, this can affect how Hash Steering functions.
When a request originates from a browser, it lacks an x-forwarded-for
header, but if a Worker proxies the request to a load balancer, the header is populated with the Worker's IP instead of the original client IP. Since the Worker's IP — often a Cloudflare public IP — can change between requests, Hash Steering may direct the same client's requests to different endpoints, leading to inconsistent traffic routing.
To ensure Hash Steering works correctly when using a Worker in front of a Load Balancer, manually set the x-forwarded-for
header in the Worker to the client's original IP address. By manually setting x-forwarded-for
to CF-Connecting-IP
, Hash Steering will function as expected, ensuring traffic consistency for end users.
Was this helpful?
- Resources
- API
- New to Cloudflare?
- Products
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark