Have HAProxy Ping the IP Address Instead of the Domain Name

The project that I’m currently working on will respond with a 418 if you’re using a subdomain. HAProxy pings my webserver evey two seconds to see if they’re alive and it is currently returning a 503. The problem is that if you load the server with polecat.example.c66.com it will, as it should, return a 418 I’m a Teapot. When you ping the IP 123.456.789.10 it properly responds with a 200.

Is there a way for me to tell HAProxy to ping the IP and not the domain name?

Hi Ben,

You should be able to accomplish this with HAProxy CustomConfig, telling it to hit the IP address rather than the DNS.

Another solution is for you to simply open a route in your application that responds with a HTTP 200 for this check, and set that in the endpoint for HAProxy.

I hope this helps!

How do I set it to the IP in the custom config?

I had a closer look, and HAProxy is already setup to use the IP address of your server. You can verify this by hitting “Rails server” from your stack page, then going to “Configure HAProxy” in the right menu and clicking “Preview” (this is the template we’ll generate for you on the server). How are you checking which endpoint it’s hitting?

If you check your load balancer page (available from the stack page), there’s a link to your HAProxy stats page which can provide you with more information about the health of the server.

Feel free to open a support ticket with us and we can investigate this in more detail on your stack.

You must be logged in to answer this question