我一直在尝试使用HAProxy实现一个负载均衡的安全代理传递。 基本上我想要做的是这样的:
request ----> haproxy passthrough -----> multiple proxy servers -----> target
现在,我不希望这只是向公众开放,所以我添加HTTP基本身份validation的HTTP请求。 它工作正常,未经授权的请求被拒绝。
但是,对于HTTPS请求,我无法做到这一点,所有这些请求都没有任何安全性或限制。
请注意,使用源IP限制是不可能的,因为请求可能来自各种来源。
这是我的haproxy.cfg文件:
global log /dev/log local0 log 127.0.0.1 local1 notice maxconn 4096 user haproxy group haproxy daemon defaults log global mode http option dontlognull retries 3 option redispatch maxconn 2000 contimeout 5000 clitimeout 50000 srvtimeout 50000 userlist L1 user john insecure-password doedoe listen webproxies 0.0.0.0:3128 bind *:3128 mode http option httplog stats enable stats uri /haproxy?stats balance roundrobin option httpclose option forwardfor server proxy01 [proxy_ip_1]:[port] check server proxy02 [proxy_ip_2]:[port] check acl auth_ok http_auth(L1) http-request auth unless auth_ok userlist L2 user johnhttps insecure-password doedoe listen webproxiesHttps 0.0.0.0:3129 mode tcp bind *:3129 balance roundrobin server proxy01 [proxy_ip_1]:[port] check server proxy02 [proxy_ip_2]:[port] check acl auth_ok_https http_auth(L2) http-request auth unless auth_ok_https
注意:[proxy_ip_1]:[port]和[proxy_ip_2]:[port]通常是真实的IP地址。
任何想法的欢迎!
谢谢