我使用以下配置从本地 127.0.0.1:2000 代理访问互联网:
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn 4096
#chroot /usr/share/haproxy
user haproxy
group haproxy
daemon
#debug
#quiet
defaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
maxconn 2000
contimeout 5000
clitimeout 50000
srvtimeout 50000
listen appname 0.0.0.0:2000
mode http
stats enable
acl white_list src 127.0.0.1
tcp-request content accept if white_list
tcp-request content reject
stats uri /haproxy?stats
stats realm Strictly\ Private
stats auth special_admin:special_username
balance roundrobin
option httpclose
option forwardfor
server lamp1 23.123.1.110:3128 check
不幸的是,我需要通过 http 基本身份验证“special_admin:special_username”对我的外部代理 23.123.1.110 进行身份验证。
我的问题是,有什么方法可以使用基本身份验证,例如:
server lamp1 http://special_admin:[email protected]:3128 check
Thanks
在您的示例中,您只需要添加必要的Authorization
标头包含授权方法和username:password
编码为 base64,如下所示:
reqadd Authorization:\ Basic\ c3BlY2lhbF9hZG1pbjpzcGVjaWFsX3VzZXJuYW1l
我创建了这样的 Base64 编码字符串:
echo -n "special_admin:special_username" | base64
有关 HTTP 基本授权的更多详细信息,请参阅https://en.wikipedia.org/wiki/Basic_access_authentication#Client_side
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)