HAProxy community

Server down, stop new requests


Hello, I need to configure haproxy so that if a server down haproxy do not send more tcp requests during the server is down (Automatically)

Is it possible to do this?

thank you so much


Use health checks to disable that new requests go to the server [1].
Use “on-marked-down shutdown-sessions” to kill existing sessions [2].

[1] http://cbonte.github.io/haproxy-dconv/1.7/configuration.html#5.2-check
[2] http://cbonte.github.io/haproxy-dconv/1.7/configuration.html#5.2-on-marked-down


thank you for your answer.

I tried the configuration but I can not find the servers when I put “check” in the config.
The log:
un 27 10:51:00 localhost haproxy[9238]: Server xxx_cluster/node2 is DOWN. 0 active

My config:
frontend https-in
mode tcp
option tcplog
log /dev/log local0 debug

    tcp-request inspect-delay 5s
    tcp-request content accept if { req.ssl_hello_type 1 }

    acl host_xxx req.ssl_sni -i xxx.domain.com

    use_backend xxx_cluster if host_xxx

backend xxx_cluster
balance leastconn
mode tcp
option ssl-hello-chk
option log-health-checks
default-server inter 10s fall 2 on-marked-down shutdown-sessions
option tcplog
server node1 check
server node2 check

Instead if I remove the “check” if it finds the servers

thanks again


Remove “option ssl-hello-chk”, reverting a TCP connection test.

Probabily your backend does not allow SSLv3 or requires SNI. You you use “check-ssl” with SNI or just revert to the TCP test like above.


this works
thanks again!