Question

Best way to configure Load Balancer with Cloudflare

Posted June 11, 2021 476 views
ApacheDigitalOcean Managed Load Balancers

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

This is my current configuration:

Cloudflare

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

DigitalOcean

  • 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

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.

×
Submit an Answer
1 answer

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