gpt4 book ai didi

HAProxy - 后端服务器的基本身份验证

转载 作者:行者123 更新时间:2023-12-02 16:05:34 24 4
gpt4 key购买 nike

我使用以下配置从本地 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:special_username@23.123.1.110:3128 check

谢谢

最佳答案

在您的示例中,您只需添加必要的 Authorization header 以及授权方法和编码为 base64 的 username:password ,如下所示:

reqadd Authorization:\ Basic\ c3BlY2lhbF9hZG1pbjpzcGVjaWFsX3VzZXJuYW1l

我创建了这样的base64编码字符串:

echo -n "special_admin:special_username" | base64

有关 HTTP 基本授权的更多详细信息,请参阅 https://en.wikipedia.org/wiki/Basic_access_authentication#Client_side

关于HAProxy - 后端服务器的基本身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33869330/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com