From 9b38175c06eb9be14abc39352b6067a38f5f02ce Mon Sep 17 00:00:00 2001 From: Peter Badida Date: Sun, 19 Jan 2020 21:08:04 +0100 Subject: [PATCH] Fallback to empty string when VIRTUAL_PATH_STRIP not specified --- nginx.tmpl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/nginx.tmpl b/nginx.tmpl index d625b02..d64de0c 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -297,20 +297,20 @@ server { {{ $is_regexp := hasPrefix "^" $location }} {{ $modifier := when $is_regexp "~" "" }} - {{ if (eq $container.Env.VIRTUAL_PATH_STRIP "true") }} + {{ if (eq (or ($container.Env.VIRTUAL_PATH_STRIP) "") "true") }} location {{ $modifier }} '{{ $location }}' { return 302 '{{ $location }}/'; } {{ end }} - {{ if (eq $container.Env.VIRTUAL_PATH_STRIP "true") }} + {{ if (eq (or ($container.Env.VIRTUAL_PATH_STRIP) "") "true") }} location {{ $modifier }} '{{ $location }}/' { {{ else }} location {{ $modifier }} '{{ $location }}' { {{ end }} {{ if eq $proto "uwsgi" }} include uwsgi_params; - {{ if (eq $container.Env.VIRTUAL_PATH_STRIP "true") }} + {{ if (eq (or ($container.Env.VIRTUAL_PATH_STRIP) "") "true") }} uwsgi_pass {{ trim $proto }}://{{ trim $container.Name }}/; {{ else }} uwsgi_pass {{ trim $proto }}://{{ trim $container.Name }}; @@ -320,7 +320,7 @@ server { include fastcgi_params; fastcgi_pass {{ trim $container.Name }}; {{ else }} - {{ if (eq $container.Env.VIRTUAL_PATH_STRIP "true") }} + {{ if (eq (or ($container.Env.VIRTUAL_PATH_STRIP) "") "true") }} proxy_pass {{ trim $proto }}://{{ trim $container.Name }}/; {{ else }} proxy_pass {{ trim $proto }}://{{ trim $container.Name }}; @@ -370,20 +370,20 @@ server { {{ $is_regexp := hasPrefix "^" $location }} {{ $modifier := when $is_regexp "~" "" }} - {{ if (eq $container.Env.VIRTUAL_PATH_STRIP "true") }} + {{ if (eq (or ($container.Env.VIRTUAL_PATH_STRIP) "") "true") }} location {{ $modifier }} '{{ $location }}' { return 302 '{{ $location }}/'; } {{ end }} - {{ if (eq $container.Env.VIRTUAL_PATH_STRIP "true") }} + {{ if (eq (or ($container.Env.VIRTUAL_PATH_STRIP) "") "true") }} location {{ $modifier }} '{{ $location }}/' { {{ else }} location {{ $modifier }} '{{ $location }}' { {{ end }} {{ if eq $proto "uwsgi" }} include uwsgi_params; - {{ if (eq $container.Env.VIRTUAL_PATH_STRIP "true") }} + {{ if (eq (or ($container.Env.VIRTUAL_PATH_STRIP) "") "true") }} uwsgi_pass {{ trim $proto }}://{{ trim $container.Name }}/; {{ else }} uwsgi_pass {{ trim $proto }}://{{ trim $container.Name }}; @@ -393,7 +393,7 @@ server { include fastcgi_params; fastcgi_pass {{ trim $container.Name }}; {{ else }} - {{ if (eq $container.Env.VIRTUAL_PATH_STRIP "true") }} + {{ if (eq (or ($container.Env.VIRTUAL_PATH_STRIP) "") "true") }} proxy_pass {{ trim $proto }}://{{ trim $container.Name }}/; {{ else }} proxy_pass {{ trim $proto }}://{{ trim $container.Name }};