From 3f6381d0faf580e6b49d7ba13a09e983e99e2808 Mon Sep 17 00:00:00 2001 From: Thomas LEVEIL Date: Sat, 14 Jan 2017 11:40:33 +0100 Subject: [PATCH] regexp: use sha1 for upstream only if regexp is used avoid confusions such as in #677 --- nginx.tmpl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nginx.tmpl b/nginx.tmpl index a6a45e6..8bef446 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -92,7 +92,8 @@ server { {{ end }} {{ range $host, $containers := groupByMulti $ "Env.VIRTUAL_HOST" "," }} -{{ $upstream_name := sha1 $host }} +{{ $is_regexp := hasPrefix "~" $host }} +{{ $upstream_name := when $is_regexp (sha1 $host) $host }} # {{ $host }} upstream {{ $upstream_name }} { {{ range $container := $containers }}