Skip to content

Commit a87512c

Browse files
committed
Add VIRTUAL_PROTO support. Update MAP_TO_ROOT check.
1 parent a505259 commit a87512c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

nginx.tmpl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ upstream {{ $subdir }} {
2929
{{ define "locations" }}
3030
{{ range $subdir, $containers := groupByMulti $ "Env.NGINX_PROXY_SUBDIRECTORY" "," }}
3131
location /{{ $subdir }} {
32-
{{ $c := where $containers "Env.NGINX_PROXY_SUBDIRECTORY_MAP_TO_ROOT" "1" }}
33-
{{ $l := len $c }}
34-
{{ if eq $l 0 }}
35-
proxy_pass http://{{ $subdir }};
32+
{{ $proto := or (first (groupByKeys $containers "Env.VIRTUAL_PROTO")) "http" }}
33+
{{ $map_to_root := or (first (groupByKeys $containers "Env.NGINX_PROXY_SUBDIRECTORY_MAP_TO_ROOT")) "1" }}
34+
{{ if eq $map_to_root "1" }}
35+
proxy_pass {{ $proto }}://{{ $subdir }}/;
3636
{{ else }}
37-
proxy_pass http://{{ $subdir }}/;
37+
proxy_pass {{ $proto }}://{{ $subdir }};
3838
{{ end }}
3939
{{ if (exists (printf "/etc/nginx/htpasswd/%s" $subdir)) }}
4040
auth_basic "Restricted {{ $subdir }}";

0 commit comments

Comments
 (0)