Merge f394596806
into e95d3e9fdf
This commit is contained in:
commit
6d046882b9
1 changed files with 5 additions and 3 deletions
|
@ -77,6 +77,8 @@ server {
|
||||||
|
|
||||||
{{ range $host, $containers := groupByMulti $ "Env.VIRTUAL_HOST" "," }}
|
{{ range $host, $containers := groupByMulti $ "Env.VIRTUAL_HOST" "," }}
|
||||||
|
|
||||||
|
{{ $host := trim $host }}
|
||||||
|
|
||||||
upstream {{ $host }} {
|
upstream {{ $host }} {
|
||||||
{{ range $container := $containers }}
|
{{ range $container := $containers }}
|
||||||
{{ $addrLen := len $container.Addresses }}
|
{{ $addrLen := len $container.Addresses }}
|
||||||
|
@ -106,7 +108,7 @@ upstream {{ $host }} {
|
||||||
{{ $default_server := index (dict $host "" $default_host "default_server") $host }}
|
{{ $default_server := index (dict $host "" $default_host "default_server") $host }}
|
||||||
|
|
||||||
{{/* Get the VIRTUAL_PROTO defined by containers w/ the same vhost, falling back to "http" */}}
|
{{/* Get the VIRTUAL_PROTO defined by containers w/ the same vhost, falling back to "http" */}}
|
||||||
{{ $proto := or (first (groupByKeys $containers "Env.VIRTUAL_PROTO")) "http" }}
|
{{ $proto := trim (or (first (groupByKeys $containers "Env.VIRTUAL_PROTO")) "http") }}
|
||||||
|
|
||||||
{{/* Get the HTTPS_METHOD defined by containers w/ the same vhost, falling back to "redirect" */}}
|
{{/* Get the HTTPS_METHOD defined by containers w/ the same vhost, falling back to "redirect" */}}
|
||||||
{{ $https_method := or (first (groupByKeys $containers "Env.HTTPS_METHOD")) "redirect" }}
|
{{ $https_method := or (first (groupByKeys $containers "Env.HTTPS_METHOD")) "redirect" }}
|
||||||
|
@ -168,7 +170,7 @@ server {
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_pass {{ trim $proto }}://{{ trim $host }};
|
proxy_pass {{ $proto }}://{{ $host }};
|
||||||
{{ if (exists (printf "/etc/nginx/htpasswd/%s" $host)) }}
|
{{ if (exists (printf "/etc/nginx/htpasswd/%s" $host)) }}
|
||||||
auth_basic "Restricted {{ $host }}";
|
auth_basic "Restricted {{ $host }}";
|
||||||
auth_basic_user_file {{ (printf "/etc/nginx/htpasswd/%s" $host) }};
|
auth_basic_user_file {{ (printf "/etc/nginx/htpasswd/%s" $host) }};
|
||||||
|
@ -197,7 +199,7 @@ server {
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_pass {{ trim $proto }}://{{ trim $host }};
|
proxy_pass {{ $proto }}://{{ $host }};
|
||||||
{{ if (exists (printf "/etc/nginx/htpasswd/%s" $host)) }}
|
{{ if (exists (printf "/etc/nginx/htpasswd/%s" $host)) }}
|
||||||
auth_basic "Restricted {{ $host }}";
|
auth_basic "Restricted {{ $host }}";
|
||||||
auth_basic_user_file {{ (printf "/etc/nginx/htpasswd/%s" $host) }};
|
auth_basic_user_file {{ (printf "/etc/nginx/htpasswd/%s" $host) }};
|
||||||
|
|
Loading…
Reference in a new issue