#--------------------------------------------------------------------- # Example configuration. See the full configuration manual online. # # http://www.haproxy.org/download/2.5/doc/configuration.txt # #--------------------------------------------------------------------- global maxconn 20000 log 127.0.0.1 local0 user haproxy pidfile /run/haproxy.pid daemon userlist creds user {{ username }} insecure-password {{ password }} frontend auth bind :8080 http-request auth unless { http_auth(creds) } mode http log global option httplog option dontlognull option forwardfor except 127.0.0.0/8 maxconn 8000 timeout client 30s use_backend contest if { hdr(host) -i {{ dns_prefix }}.{{ dns_suffix }} } use_backend rank if { hdr(host) -i {{ dns_prefix }}-ranking.{{ dns_suffix }} } use_backend admin if { hdr(host) -i {{ dns_prefix }}-admin.{{ dns_suffix }} } frontend main # bind :80 bind :443 ssl crt /etc/haproxy/cert.pem mode http log global option httplog option dontlognull option forwardfor except 127.0.0.0/8 maxconn 8000 timeout client 30s use_backend secure if { hdr(host) -i {{ dns_prefix }}.{{ dns_suffix }} } use_backend secure if { hdr(host) -i {{ dns_prefix }}-ranking.{{ dns_suffix }} } use_backend secure if { hdr(host) -i {{ dns_prefix }}-admin.{{ dns_suffix }} } backend secure mode http balance roundrobin timeout connect 5s timeout server 30s timeout queue 30s server secure1 127.0.0.1:8080 check backend contest mode http balance roundrobin timeout connect 5s timeout server 30s timeout queue 30s server contest1 127.0.0.1:8888 check backend admin mode http balance roundrobin timeout connect 5s timeout server 30s timeout queue 30s server admin1 127.0.0.1:8889 check backend rank mode http balance roundrobin timeout connect 5s timeout server 30s timeout queue 30s server rank1 127.0.0.1:8890 check