我正在使用haproxy进行负载平衡。我需要使用用户名和密码验证。但是身份验证不起作用,并且我不断收到401
错误。这是我的配置:
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
daemon
stats socket /home/rahul/haproxy_setup/haproxy/haproxy.sock mode 600 level admin
stats timeout 2m
user root
group root
defaults
mode http
log global
maxconn 10000
#retries 3
#option redispatch
timeout client 3600s
timeout connect 1s
timeout queue 5s
timeout server 3600s
listen stats
bind 0.0.0.0:2091
mode http
stats enable
stats uri /
stats realm test
stats auth test:testpass
userlist testUsers
user test insecure-password testpass
listen req-in
bind 0.0.0.0:9101
mode http
default_backend tinyproxy
balance roundrobin
acl authorized http_auth(testUsers)
http-request auth realm test if !authorized
backend tinyproxy
mode http
server serv1 127.0.0.1:3128 check
使用curl时,我得到以下输出:
curl -x http://test:testpass@my_ip_host:9101 wtfismyip.com/text
401未经授权
您需要有效的用户名和密码才能访问此内容。
有人可以解释我在做什么错吗?