global log stdout format raw local0 info maxconn 2000 tune.ssl.default-dh-param 2048 # intermediate configuration ssl-default-bind-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384 ssl-default-bind-ciphersuites TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256 ssl-default-bind-options prefer-client-ciphers no-sslv3 no-tlsv10 no-tlsv11 no-tls-tickets ssl-default-server-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384 ssl-default-server-ciphersuites TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256 ssl-default-server-options no-sslv3 no-tlsv10 no-tlsv11 no-tls-tickets ssl-dh-param-file /etc/haproxy/dhparam defaults log global timeout connect 3s timeout client 10s timeout server 10m {% if data["customerrors"] %} errorfile 400 /etc/haproxy/errors-custom/400.http errorfile 403 /etc/haproxy/errors-custom/403.http errorfile 408 /etc/haproxy/errors-custom/408.http errorfile 500 /etc/haproxy/errors-custom/500.http errorfile 502 /etc/haproxy/errors-custom/502.http errorfile 503 /etc/haproxy/errors-custom/503.http errorfile 504 /etc/haproxy/errors-custom/504.http {% endif %} {% if "stats" in data %} frontend stats bind *:{{ data["stats"]["port"] | default(1936) }} mode http stats enable stats hide-version stats realm Haproxy\ Statistics stats uri / stats auth {{ data["stats"]["username"] }}:{{ data["stats"]["password"] }} # acl is_proxystats hdr(host) -i some.host.com # default_backend srv_stats # use_backend srv_stats if is_proxystats default_backend srv_stats backend srv_stats mode http server Local 127.0.0.1:{{ data["stats"]["port"] | default(1936) }} {% endif %} {% for o in data["easymapping"] -%} {% set mode = o["mode"] or "http" %} frontend {{ mode }}_in_{{ o["port"] }} {% include "bind.j2" %} {% if mode == "http" %} {% include "frontend-mode-http.j2" %} {% else %} {% include "frontend-mode-tcp.j2" %} {% endif %} {% for k in o["hosts"] -%} {% set host = k.replace(".", "_") + "_{0}".format(o["port"]) %} backend srv_{{ host }} balance roundrobin mode {{ mode }} {% if mode == "http" %} option forwardfor http-request set-header X-Forwarded-Port %[dst_port] http-request add-header X-Forwarded-Proto https if { ssl_fc } {% elif mode == "tcp" %} option tcp-check tcp-check connect{{ " ssl" if o["health-check"] == "ssl" }} {% endif %} {% for c in o["hosts"][k]["containers"] %} server srv-{{ loop.index0 }} {{ c }} check weight 1{{ " verify none" if o["health-check"] == "ssl" }} {% endfor %} {% endfor %} {% endfor %} backend letsencrypt_backend mode http server certbot 127.0.0.1:2080