HA Proxy Example
global
daemon
nbproc 1
user haproxy
group haproxy
log 127.0.0.1:514 local0
pidfile /var/run/haproxy.pid
stats socket /var/run/haproxy.stat mode 777
tune.comp.maxlevel 5
maxcompcpuusage 98
maxconn 30000
spread-checks 5
defaults
mode http
log global
option httplog
option http-server-close
option dontlognull
option redispatch
option splice-auto
option clitcpka
option srvtcpka
option tcp-smart-accept
option tcp-smart-connect
option contstats
retries 3
timeout http-request 5s
timeout http-keep-alive 5s
timeout connect 5s
timeout client 25s
timeout client-fin 30s
timeout tunnel 1h
timeout server 25s
timeout queue 10s
timeout tarpit 15s
backlog 10000
compression algo gzip
compression type text/html text/html;charset=utf-8 text/html;charset=ISO-8859-1 text/plain text/css text/javascript application/x-javascript application/javascript application/ecmascript application/rss+xml application/atomsvc+xml application/atom+xml application/atom+xml;type=entry application/atom+xml;type=feed application/cmisquery+xml application/cmisallowableactions+xml application/cmisatom+xml application/cmistree+xml application/cmisacl+xml application/msword application/vnd.ms-excel application/vnd.ms-powerpoint
errorfile 408 /dev/null # workaround Chrome pre-connect bug
frontend http
bind *:80
maxconn 1000
http-request set-header X-Forwarded-For %[src]
option forwardfor header Proxy-ip
rspidel ^Server:.*
rspidel ^X-Powered-By:.*
acl is_ws path_beg /wsdc hdr(Upgrade) -i websocket
acl is_comet path_beg /cometd/
use_backend bk_comet if is_comet
use_backend bk_ws if is_ws
default_backend bk_web
#Optional example frontend for terminating SSL at the load balancer
frontend https
mode http
option forwardfor
bind *:8443 ssl crt <path_to_pem_file>
reqadd X-Forwarded-Proto:\ https
rspiprep ^Location:\ http:(.*) Location:\ https:\1
acl is_ws path_beg /wsdc hdr(Upgrade) –i websocket
acl is_comet path beg /cometd/
use_backend bk_comet if is_comet
use_backend bk_ws if is_ws
default_backend bk_web
backend bk_web
option httpchk GET /ping.html HTTP/1.1\r\nHost:\ www
acl is_static capture.req.uri -m end .css .png .jpg .gif .js .favicon.ico
rspadd Cache-Control:\ public if is_static
server oas1 10.0.41.172:8080 check
server oas2 10.0.47.106:8080 check backup
backend bk_comet
timeout server 120s
option httpchk GET /ping.html HTTP/1.1\r\nHost:\ www
cookie comet insert
server oas1 10.0.41.172:8080 check
server oas2 10.0.47.106:8080 check backup
backend bk_ws
server oas1 10.0.41.172:8888 check on-marked-up shutdown-backup-sessions
server oas2 10.0.47.106:8888 check backup
listen stats :9090
mode http
no log
stats enable
stats refresh 15s
stats uri /stats