We are using HAProxy to forward incoming TCP connections to a separate server that uses a raw TCP. The issue that we are seeing is that the client connection is accepted and then closed rather then rejected immediately. Since we have enabled a health check is there any way for HAProxy to unbind from the port so that the initial connection fails?
listen custom_forward
mode tcp
bind *:11144
default-server inter 10m fastinter 20s downinter 1m maxconn 100
server custom_server hostname:10144 check
You want to explicitly reject the connection if backend servers are down:
acl site_dead nbsrv lt 1
tcp-request connection reject if site_dead
Or acl site_dead nbsrv(backend_name) lt 1
where backend_name
is the name of a different backend.
nbsrv documentation
acl documentation
tcp-reject documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With