HTTP Health check using DigitalOcean Load Balancer & ServerPilot

July 31, 2018 1.5k views
Load Balancing Ubuntu 16.04

Hi,

This is not a question, but a something that I had to share with anyone who may come across the same issue.

I have setup a Highly Available (HA) WordPress environment using 4 droplets. Two are application droplets managed by ServerPilot and the other 2 are MySQL 8.x Database servers with Group Replication, load balanced with ProxySQL (highly recommend this).

What I wanted to do was use the DO Load Balancer (LB) service for the 2 application droplets but I could not get the HTTP Health check working. The Load balancer kept on complaining that the droplets were offline, when they were not. The TCP health check was working, but I needed HTTP.

Long story short, there was no Default app for the application settings in ServerPilot, and “Deny requests for unknown domains” was ON. Since the DO Load Balancer uses a the private IPs to check the health of each droplet and not a domain, the health checks were failing (Nginx was returning a 444). Once the “Deny requests for unknown domains” was turned OFF, the LB was able to get a 200 from Nginx and everyone’s happy.

Last but not least, make sure you have assigned the droplet private IPs to your applications in ServerPilot to make sure they are accessible by the LB for health checks

Hope that helps someone.

A

1 Answer

We had a similar problem with a Laravel application that we had built.

Our Laravel application was using “domain routing”, which meant that any request that was not for a domain in our list was returning a 404 error. The load balancer is sending the domain name “cloud.digitalocean.com”, which our application did not recognize.

Once we added routing to recognize this domain name, the HTTP health checks began to work fine.

Have another answer? Share your knowledge.