一个简单的需求,就是需要在 haproxy 的 httpcheck 使用 basic 认证,解决方法
base64 编码username 以及密码
echo -n "my_username:my_password" | base64
配置basci 认证
header 配置
option httpchk GET /CSHRIS/WS/Service.asmx HTTP/1.0rnAuthorization: Basic TkxCX0hCOkhCREhCX0NoZWNr
参考资料
https://serverfault.com/questions/801247/haproxy-httpchk-with-authentication
https://discourse.haproxy.org/t/haproxy-health-checks-with-authentication/94/4
https://www.haproxy.org/download/1.7/doc/configuration.txt