File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -99,10 +99,14 @@ server {
99
99
{{ end }}
100
100
101
101
{{ range $host, $containers := groupByMulti $ "Env.VIRTUAL_HOST" "," }}
102
+
103
+ {{ $host := trim $host }}
102
104
{{ $is_regexp := hasPrefix "~" $host }}
103
105
{{ $upstream_name := when $is_regexp (sha1 $host) $host }}
106
+
104
107
# {{ $host }}
105
108
upstream {{ $upstream_name }} {
109
+
106
110
{{ range $container := $containers }}
107
111
{{ $addrLen := len $container.Addresses }}
108
112
@@ -131,7 +135,7 @@ upstream {{ $upstream_name }} {
131
135
{{ $default_server := index (dict $host "" $default_host "default_server") $host }}
132
136
133
137
{{/* Get the VIRTUAL_PROTO defined by containers w/ the same vhost, falling back to "http" */}}
134
- {{ $proto := or (first (groupByKeys $containers "Env.VIRTUAL_PROTO")) "http" }}
138
+ {{ $proto := trim ( or (first (groupByKeys $containers "Env.VIRTUAL_PROTO")) "http") }}
135
139
136
140
{{/* Get the HTTPS_METHOD defined by containers w/ the same vhost, falling back to "redirect" */}}
137
141
{{ $https_method := or (first (groupByKeys $containers "Env.HTTPS_METHOD")) "redirect" }}
@@ -205,6 +209,7 @@ server {
205
209
{{ else }}
206
210
proxy_pass {{ trim $proto }}://{{ trim $upstream_name }};
207
211
{{ end }}
212
+
208
213
{{ if (exists (printf "/etc/nginx/htpasswd/%s" $host)) }}
209
214
auth_basic "Restricted {{ $host }}";
210
215
auth_basic_user_file {{ (printf "/etc/nginx/htpasswd/%s" $host) }};
You can’t perform that action at this time.
0 commit comments