我可能已经迷失在关于这个主题的大量文档中,但我正在尝试配置我的 HAProxy 进程以发送代理协议标头,如http://www.haproxy.org/download/1.8/doc/ 所述代理协议.txt。这是因为我必须将 PROXY 协议的支持写入 C++ 服务器(以便它能够访问客户端 IP/端口),并且我想测试我的代码在解析 PROXY 标头时是否正常工作。
这是我的最小配置文件:
global
maxconn 4096
defaults
log global
mode http
retries 3
option redispatch
maxconn 2000
timeout connect 5000
timeout client 50000
timeout server 50000
frontend TestServerTest
bind 10.6.186.24:54781
mode tcp
default_backend TestServernodes
backend TestServernodes
mode tcp
# Note there is no 'check' after the below line unlike the others as we don't want to send the
# healthcheck ("OPTIONS / HTTP/1.0"...) string to the TestServer as it …Run Code Online (Sandbox Code Playgroud)