Question

DigitalOcean Load Balancer and Cloudflare

I use Cloudflare with the proxy feature for my servers. And I’m thinking of using DigitalOcean’s load balancing feature instead of CF. The problem is that the CF changes the source IPs for each request, can this affect the navigation of my users?

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

DigitalOcean Load Balancers will set some HTTP headers that pass the source IP through to your backend servers, like CloudFlare does with X-Forwarded-For, and CF-Connecting-IP headers.

From the Protocol Support section of the docs:

The load balancer sets the X-Forwarded-For, X-Forwarded-Proto, and X-Forwarded-Port headers to give the backend servers information about the original request.

So that’s one way to access the client/source IP information for an incoming HTTP request.

Another is to use the PROXY Protocol support that’s built in - but there you have to make sure your backend servers support it, otherwise the Load Balancer will mark them unhealthy.