How to Configure TCP Keep alive timeout in HAProxy



Can someone tell me how to configure TCP keepalive timeout in HAProxy.

The request from HAProxy to my server hangs. So I need to timeout the TCP session. I have configured below parameters in my HAProxy. But it fails to timeout within 30s or 1 miniute. It takes very long to get timeout.

So please let me know how to configure TCP keepalivce
timeout in HAProxy.
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout tunnel 30s
timeout client 30s
timeout server 10s



You need to provide a more complete configuration, the haproxy release you are using and a more thorough description of the problem.

Is this http mode? If yes, what keep-alive mode? Is it just tcp mode? Are you sure the is not traffic on those supposedly “hang” sessions? What is the protocol?


For example you may refer following configuration:
log local3
maxconn 4096
user haproxy
group haproxy

listen messagebroker_balancer
mode tcp
log global
retries 3
timeout connect 5000ms
option redispatch
timeout client 200000ms
timeout server 200000ms
option tcplog
option clitcpka
balance leastconn
server s1 check inter 5s rise 2 fall 3
server s2 check inter 5s rise 2 fall 3