Last active
June 21, 2019 06:20
-
-
Save dvdvnl/4e969aedcd3d2920c2690a0a7fff7262 to your computer and use it in GitHub Desktop.
HAProxy configuration (gist for http://www.davole.com/2017/haproxy-for-docker-containers)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global | |
tune.ssl.default-dh-param 2048 | |
maxconn 100 | |
daemon | |
defaults | |
mode http | |
timeout connect 4s | |
timeout http-request 1s | |
timeout http-keep-alive 120s | |
timeout client 1m | |
timeout server 1m | |
timeout queue 10s | |
option splice-auto | |
option dontlog-normal | |
option tcp-smart-accept | |
option tcp-smart-connect | |
option forwardfor | |
option http-keep-alive | |
http-reuse safe | |
frontend www-http | |
bind :80 | |
reqadd X-Forwarded-Proto:\ http | |
# hosts | |
acl host_frn hdr(host) -i front.example.com | |
acl host_bck hdr(host) -i back.example.com | |
# https redirect | |
redirect scheme https code 301 if !{ ssl_fc } host_frn OR !{ ssl_fc } host_bck | |
frontend www-https | |
bind :443 ssl crt /usr/local/etc/haproxy/example.com.pem | |
reqadd X-Forwarded-Proto:\ https | |
# hosts | |
acl host_frn hdr(host) -i front.example.com | |
acl host_bck hdr(host) -i back.example.com | |
# backends | |
use_backend front if host_frn | |
use_backend front if host_bck | |
resolvers docker | |
nameserver dns1 127.0.0.11:53 | |
backend front | |
server front frn:80 check inter 10s resolvers docker | |
backend back | |
server back bck:80 check inter 10s resolvers docker |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment