Best way to configure Load Balancer with Cloudflare

I need to integrate Cloudflare with my droplets through the Managed Load Balancer provided by DigitalOcean.

This is my current configuration:


  • WAF Configured
  • Proxy Navigation Enabled (To support WAF)
  • Use of SSL provided by Cloudflare
  • IPv6 Enabled


  • Two Droplets with Apache
  • HTTP2 Enabled
  • IPv6 Enabled
  • SSL/HTTPS configured with my own security certificate from my domain
  • Cloud Firewall rules that only allow access on port 80 and 443 by the DO balancer

How should I configure the DigitalOcean load balancer to support this integration, and keep the original IP of the client coming from Cloudflare?

Access Flowchart

Submit an answer

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Hi there,

The setup looks very good. The 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.

Hope that this helps! Regards, Bobby