Number of attempts before they consider healthy or unhealthy
Header name validation
And finally, save the configuration and deploy
LB will perform a health check, and in a few seconds, you will see the status is healthy.
Great, this concludes Cloudflare load balancer is ready to accept traffic from the world and forward it to the configured origin servers.
Testing Load Balancer
Let’s perform a basic test to see if it works.
First, try to access the domain.
LB forwarded a request to Google Cloud VM and got the response. I can see the request in Nginx.
188.8.131.52 - - [19/Dec/2017:10:25:41 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36"
Let me shut down Nginx on GCP and access the page again.
And here you go. A requested page is served from AWS.
I can see LB took GCP pool member down.
By default, Cloudflare IP will be shown in Nginx access logs, and if you need to restore client IP, then you can check out this guide.
Implementing a Cloudflare load balancer is straightforward and can get it started in less than 15 minutes. If you are looking for high availability between multiple data centers or origin servers, try it to see how it works.
As the founder of Geekflare, I’ve helped millions to excel in the digital realm. Passionate about technology, I’m on a mission to explore the world and amplify growth for professionals and businesses alike.