A little late, but I ran into the same problem and wanted to share the solution with the world. First, you base64 encode the credentials:
$ echo -n "user:pass" | base64 dXNlcjpwYXNz
(Make sure you use the -n switch to not add a new line.)
option httpchk allows you to add arbitrary HTTP headers to the request; this feature is not well documented. (According to this discussion, future versions of Haproxy may get a more user-friendly method.) To use basic authentication:
option httpchk GET /solr/ HTTP/1.0\r\nAuthorization:\ Basic\ dXNlcjpwYXNz
Please note that I used HTTP 1.0; for version 1.1 you also need a node header.
Mike baranczak
source share