我想建立一个系统,其中有 3 个 squid 代理服务器在后面运行负载均衡器。目前 squid 代理正在 http 端口上运行,(如果您对 https_port 有帮助,也非常感谢)
dns_v4_first on
acl loadbalancer src 174.138.123.136/32
# allow only https ports
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 443 # https
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost manager
http_access deny manager
include /etc/squid/conf.d/*.conf
auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/passwords
auth_param basic realm proxy
acl authenticated proxy_auth REQUIRED
http_access allow localhost
http_access allow authenticated
http_access deny all
http_port 8080
coredump_dir /var/spool/squid
当我在 https 中提供目标 url 时,它可以正常工作,否则它会给出来自负载均衡器 ip 的错误。
curl -x http://user:pass@lb_ip:8080 https://ifconfig.me # works
curl -x http://user:pass@lb_ip:8080 http://ifconfig.me # does not work
第二种情况的错误是
<h1>ERROR</h1>
<h2>The requested URL could not be retrieved</h2>
</div>
<hr>
<div id="content">
<p>The following error was encountered while trying to retrieve the URL: <a href="/">/</a></p>
当我尝试/test
在示例中附加路径时。确认使用时原点被剥离http://
curl -sx http://user:pass@lb_ip:8080 http://ifconfig.me/test | grep /test
<p>The following error was encountered while trying to retrieve the URL: <a href="/test">/test</a></p>
但在两种情况下直接使用均可
curl -x http://user:pass@direct_ip:8080 https://ifconfig.me # works
curl -x http://user:pass@direct_ip:8080 http://ifconfig.me # works