Docker template generator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

haproxy.cfg.tpl 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. global
  2. ssl-default-bind-ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256
  3. ssl-default-bind-options no-sslv3 no-tlsv10 no-tlsv11 no-tls-tickets
  4. ssl-default-server-ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256
  5. ssl-default-server-options no-sslv3 no-tlsv10 no-tlsv11 no-tls-tickets
  6. resolvers docker_resolver
  7. nameserver dns 127.0.0.11:53
  8. defaults
  9. log global
  10. mode http
  11. timeout connect 5000
  12. timeout client 30000
  13. timeout server 30000
  14. compression algo gzip
  15. compression type text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript
  16. default-server init-addr last,libc,none check resolvers docker_resolver
  17. frontend main
  18. mode http
  19. bind :::443 v4v6 ssl strict-sni alpn h2,http/1.1 crt /certs/
  20. bind :::80 v4v6
  21. http-request set-header X-Forwarded-For %[src]
  22. http-request set-header X-Forwarded-Proto https if { ssl_fc }
  23. redirect scheme https code 301 if !{ ssl_fc }
  24. http-response set-header Strict-Transport-Security max-age=15768000
  25. {{- range .Hostnames }}
  26. use_backend {{ .Name | replace "." "_" }} if { hdr(host) -i {{ .Name }}
  27. {{- range $san, $_ := .Alternatives }} || hdr(host) -i {{ $san }} {{- end }} }
  28. {{- end -}}
  29. {{ range .Hostnames }}
  30. backend {{ .Name | replace "." "_" }}
  31. mode http
  32. {{- range .Containers }}
  33. {{- if index .Labels "com.chameth.proxy" }}
  34. server server1 {{ .Name }}:{{ index .Labels "com.chameth.proxy" }}
  35. {{- end -}}
  36. {{- end -}}
  37. {{- if .RequiresAuth }}
  38. acl authed_{{ .Name | replace "." "_" }} http_auth({{ .AuthGroup }})
  39. http-request auth if !authed_{{ .Name | replace "." "_" }}
  40. {{- end -}}
  41. {{ end }}