I am using HAProxy on EC2 and using httpchk to manage node availability. I had used a pseudo-unique path as the health check route in an attempt to make sure only my servers responded to the health check. Earlier today I had an EC2 server fall out of existence, and before the haproxy config was auto-regenerated (controller issues), Amazon had reassigned the IP to someone whom 200's every request (honeypot?), my HAProxy host then pulled the server back into rotation and started distributing some of my traffic there until the controller recovered and removed the ip from the list.


Is there a way to add a server authentication method to HAProxy's httpchk?


No, but you can use

http-check expect

Which lets you define what the response should look like.

For example:

http-check expect ! string Foo\ Bar

will only succeed if you have that string on the page.

I can't link directly in the docs, but load up http://haproxy.1wt.eu/download/1.5/doc/configuration.txt and search for "http-check expect" for more info.

| improve this answer | |

It is very well possible. If you'd read the manual, you'd have found how:

option httpchk GET /manager/html/list HTTP/1.1\r\nHost:\ myserver.my.domain:8080\r\nAuthorization:\ Basic\ MyT41l0r1sR1ch
| improve this answer | |
  • 2
    Goodness. Your first answer and this is how you choose to do it? – GregL Feb 10 '16 at 12:51
  • I know, you're right, I was cross with the first replier. PS. this is only my first answer on ServerFault, but I've been hurting people's feelings on the web for decades. – Gerard H. Pille Feb 11 '16 at 8:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.