From 8b6793efe79b21a5effe6dadf26ce880998988af Mon Sep 17 00:00:00 2001 From: pierreozoux <pierre@ozoux.net> Date: Sat, 6 Aug 2016 12:58:43 +0100 Subject: [PATCH] Use VIRTUAL_HOST --- templates/haproxy.cfg.tmpl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/templates/haproxy.cfg.tmpl b/templates/haproxy.cfg.tmpl index 95762da..4d05e14 100644 --- a/templates/haproxy.cfg.tmpl +++ b/templates/haproxy.cfg.tmpl @@ -33,15 +33,16 @@ mode http rspadd Strict-Transport-Security:\ max-age=15768000 use_backend letsencrypt if { path_beg /.well-known/acme } -{{ range $host, $container := groupBy $ "Env.HOST" }} - use_backend {{ $host}} if { hdr(host) -i {{ $host }} www.{{ $host }} } +{{ range $host, $containers := groupByMulti $ "Env.VIRTUAL_HOST" "," }} + use_backend {{ $host}} if { hdr(host) -i {{ $host }} } {{end}} -{{ $containers := whereExist $ "Env.HOST" }} -{{ range $container := $containers }} -backend {{ $container.Env.HOST }} +{{ range $host, $containers := groupByMulti $ "Env.VIRTUAL_HOST" "," }} +backend {{ $host }} cookie SERVERID insert nocache indirect + {{ range $container := $containers }} server Server {{ $container.IP }}:80 cookie Server + {{end}} {{end}} backend letsencrypt -- GitLab