Skip to content

Instantly share code, notes, and snippets.

@sebandgo
Last active June 28, 2019 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sebandgo/0aed3e1e10220754e7af41c89a972c7c to your computer and use it in GitHub Desktop.
Save sebandgo/0aed3e1e10220754e7af41c89a972c7c to your computer and use it in GitHub Desktop.
Load Balancer - Part 2 - HAProxy Setup
global
maxconn 10000
stats socket /var/run/haproxy.stat mode 600 level admin
log 127.0.0.1 local2
tune.ssl.default-dh-param 2048
chroot /var/empty
daemon
frontend public
bind *:8181 name clear
mode http
log global
option httplog
option dontlognull
option forwardfor
monitor-uri /monitoruri
maxconn 8000
timeout client 30m
default_backend dynamic
backend dynamic
mode http
balance roundrobin
option forwardfor
retries 2
option redispatch
timeout connect 5s
timeout server 10s
timeout queue 1m
option httpchk HEAD / HTTP/1.0
cookie lbp001 insert indirect nocache
fullconn 4000
server server-hostname-web001 10.0.1.1:80 weight 1 cookie srvweb001 check inter 10s
server server-hostname-web002 10.0.1.2:80 weight 1 cookie srvweb002 check inter 10s
# http-response set-header Strict-Transport-Security "max-age=16000000; includeSubDomains; preload;"
http-request set-header X-Forwarded-Port %[dst_port]
http-request add-header X-Forwarded-Proto https if { ssl_fc }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment