소스 검색

regexp: use sha1 for upstream only if regexp is used

avoid confusions such as in #677
Thomas LEVEIL 8 년 전
부모
커밋
3f6381d0fa
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      nginx.tmpl

+ 2 - 1
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 }}