diff --git a/confd/templates/haproxy.cfg.tmpl b/confd/templates/haproxy.cfg.tmpl index 64613f465900a7cdc1f4e56d5165968edc42a99d..344745d7503986f0785cdd4e89861b7a1df4baa5 100644 --- a/confd/templates/haproxy.cfg.tmpl +++ b/confd/templates/haproxy.cfg.tmpl @@ -38,7 +38,17 @@ default_backend {{$default_service.hostname}} frontend http-in bind *:80 - redirect scheme https code 301 if !{ ssl_fc } +{{range $app := lsdir "/services"}} +{{$hostnames := printf "/services/%s/*" $app}} + {{range gets $hostnames}} + {{$hostname := .Key}} + {{$data := json .Value}} +# {{base $hostname}}: + acl is_{{base $hostname}} hdr(host) -i {{base $hostname}} + acl is_{{base $hostname}} hdr(host) -i www.{{base $hostname}} + use_backend {{base $hostname}} if is_{{base $hostname}} + {{end}} +{{end}} {{range $app := lsdir "/services"}} {{$hostnames := printf "/services/%s/*" $app}}