Skip to content
haproxy.cfg.tmpl 2.16 KiB
Newer Older
Pierre Ozoux's avatar
Pierre Ozoux committed
global
  log /dev/log local0 info
  log /dev/log local0 notice
  maxconn 4096
  tune.ssl.default-dh-param 2048
  ssl-default-bind-ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA

defaults
  log global
  mode http
  option forwardfor
  option httpclose
Pierre Ozoux's avatar
Pierre Ozoux committed
  option http-server-close
Pierre Ozoux's avatar
Pierre Ozoux committed
  option httplog
  option dontlognull
  retries 3
Pierre Ozoux's avatar
Pierre Ozoux committed
  compression algo gzip
  compression type text/html text/plain text/css application/javascript
Pierre Ozoux's avatar
Pierre Ozoux committed
  timeout connect 5000
  timeout client 50000
  timeout server 50000

frontend http-in
  bind *:80
{{ range $host, $container := groupBy $ "Env.AUTOCONFIG_HOST" }}
  redirect location https://{{ $host }}/mail/config-v1.1.xml code 301 if { hdr_beg(host) -i autoconfig }
{{end}}
  redirect scheme https code 301

frontend https-in
mode http
  bind *:443 ssl no-sslv3 crt /etc/haproxy/certs
  reqadd X-Forwarded-Proto:\ https
  rspadd  Strict-Transport-Security:\ max-age=15768000

Pierre Ozoux's avatar
Pierre Ozoux committed
  use_backend letsencrypt-web if { path_beg /.well-known/acme }
Pierre Ozoux's avatar
Pierre Ozoux committed
{{ range $host, $containers := groupByMulti $ "Env.VIRTUAL_HOST" "," }}
  use_backend {{ $host}} if { hdr(host) -i {{ $host }} }
Pierre Ozoux's avatar
Pierre Ozoux committed
{{end}}

Pierre Ozoux's avatar
Pierre Ozoux committed
{{ range $host, $containers := groupByMulti $ "Env.VIRTUAL_HOST" "," }}
backend {{ $host }}
Pierre Ozoux's avatar
Pierre Ozoux committed
  option http-server-close
Pierre Ozoux's avatar
Pierre Ozoux committed
  cookie SERVERID insert nocache indirect
Pierre Ozoux's avatar
Pierre Ozoux committed
  {{ range $container := $containers }}
  {{ $network := index $container.Networks 0 }}
  server Server {{ $network.IP }}:80 cookie Server
Pierre Ozoux's avatar
Pierre Ozoux committed
  {{end}}
Pierre Ozoux's avatar
Pierre Ozoux committed
{{end}}

Pierre Ozoux's avatar
Pierre Ozoux committed
backend letsencrypt-web
Pierre Ozoux's avatar
Pierre Ozoux committed
  cookie SERVERID insert nocache indirect
Pierre Ozoux's avatar
Pierre Ozoux committed
  server Server letsencrypt-web:80 cookie Server