HAProxy重置后端连接

我正在设置一系列服务器作为我们的应用服务器的代理,主要是为了模糊应用服务器的IP作为一套反DDOS措施的一部分。

我的目标是让HAProxy接受短暂的HTTP / 1.0连接,并通过持续连接将它们转发到后端,从而显着减less连接过程中的开销,缓慢启动等。

我有这个configuration部分工作,但仍然看到比预期更高的后端连接速度 – 调查显示,每个后端连接正在服务1到5个请求,然后由HAProxy方复位。

这些重置数据包总是在服务器完全接收到响应之后发生,在发送任何进一步的请求之前,它们在看似随机的延迟之后发生 – 有时短至0.1s,有时长达20s。 改变HAProxy的超时设置似乎没有效果。

有谁知道什么会导致HAProxy展示这种行为,或者我可能会更好地去debugging它?

编辑:忘了提及,我无法得到后端生成任何有意义的日志,即使使用tcplog

configuration(redacted):

global log /dev/log local0 log /dev/log local1 notice stats socket /run/haproxy/admin.sock mode 660 level admin stats timeout 30s maxconn 16384 chroot /var/lib/haproxy user haproxy group haproxy daemon defaults log global mode http option httplog option dontlognull option http-keep-alive timeout connect 5s timeout client 50s timeout server 50s timeout http-keep-alive 50s timeout http-request 30s maxconn 4000 errorfile 400 /etc/haproxy/errors/400.http errorfile 403 /etc/haproxy/errors/403.http errorfile 408 /etc/haproxy/errors/408.http errorfile 500 /etc/haproxy/errors/500.http errorfile 502 /etc/haproxy/errors/502.http errorfile 503 /etc/haproxy/errors/503.http errorfile 504 /etc/haproxy/errors/504.http # Temporary setting, egress is fragile w/ high rate of connections default-server maxconn 200 frontend fe-web bind 0.0.0.0:80 acl cloudflare src -f /etc/haproxy/cloudflare_ips block if !cloudflare use_backend be-web frontend fe-legacy bind 0.0.0.0:29080 option forwardfor header CF-Connecting-IP use_backend be-legacy backend be-web server srv-web 46.105.16.9:34020 check option httpchk HEAD / HTTP/1.1\r\nHost:\ legacy-domain backend be-legacy server srv-legacy 46.105.16.9:34020 check option httpchk HEAD / HTTP/1.1\r\nHost:\ legacy-domain