global log stdout format raw local0 debug user haproxy group haproxy # this is to tackle a weird problem I observed # https://github.com/docker-library/haproxy/issues/180 fd-hard-limit 10000 daemon defaults log global mode http option httplog option dontlognull maxconn 1000 timeout connect 5000 timeout client 50000 timeout server 50000 frontend http_front bind :8443 ssl crt /usr/local/etc/haproxy/tls/certificate.pem alpn h2,http/1.1 {% for hostname in nginx_names %} acl be_{{ hostname }} path_beg /{{ hostname }} {% endfor %} {% for hostname in nginx_names %} use_backend be_{{ hostname }} if be_{{ hostname }} {% endfor %} acl be_round_robin path / use_backend be_round_robin if be_round_robin {% for hostname in nginx_names %} !be_{{ hostname }} {% endfor %} {% for hostname in nginx_names %} backend be_{{ hostname }} mode http http-request set-path %[path,regsub(^/{{ hostname }},"")] server {{ hostname }} {{ hostname }}:80/ {% endfor %} backend be_round_robin mode http {% for hostname in nginx_names %} http-request set-path %[path,regsub(^/{{ hostname }}/,/)] server {{ hostname }} {{ hostname }}:80/ {% endfor %}