In my environment I have haproxy load balance for 2 web servers (Apache), this is my HA Proxy configuration :
global
log 127.0.0.1 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy
tune.ssl.default-dh-param 2048
daemon
nbproc 1
stats socket /var/lib/haproxy/stats
stats timeout 1m
nogetaddrinfo
listen front
bind :80
redirect scheme https if { hdr(Host) -i domain.com } !{ ssl_fc }
listen front_ssl
bind :443 ssl crt /opt/certificate/domain.pem
mode http
option dontlognull
stats enable
stats uri /ha?stats
stats realm system
stats auth root:*********
stats refresh 5s
option http-keep-alive
option forwardfor
option redispatch
reqadd X-Forwarded-Proto:\ https if { ssl_fc }
timeout client 15s
timeout connect 3s
timeout server 15s
timeout http-request 15s
timeout http-keep-alive 15s
default_backend bk_http
backend bk_http
mode http
balance source
option http-keep-alive
default-server inter 1s
retries 3
timeout connect 3s
timeout server 15s
timeout queue 60s
timeout check 10s
timeout http-request 15s
timeout http-keep-alive 15s
server node1 1.2.3.4:82 check id 1 weight 1 maxconn 2000 maxqueue 2000
server node2 5.6.7.8:82 check id 1 weight 1 maxconn 2000 maxqueue 2000
"KeepAlive On" in /etc/httpd/conf/httpd.conf But when I test with curl, I see that keepalive is not work :
curl -Iv http://domain.com 2>&1 | grep -i 'connection #0'
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Closing connection #0
curl -Iv https://domain.com 2>&1 | grep -i 'connection #0'
* Closing connection #0
As I know if keepalive is working, result should be :
0 162 0 0 0 0 0 0 --:--:-- 0:00:05 --:--:-- 0* Connection #0 to host domain.com left intact
* Closing connection #0
Please let me know if something wrong in my configuration ?