diff --git a/nginx.tmpl b/nginx.tmpl index ff04268..3204754 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -276,8 +276,8 @@ grpc_pass {{ trim $proto }}://{{ trim $upstream }}; {{- else }} proxy_pass {{ trim $proto }}://{{ trim $upstream }}{{ trim $dest }}; - {{- if not (eq .Path "/") }} - proxy_redirect ~^/(.*)$ {{ trimSuffix `/` .Path }}/$1; + {{- if (hasPrefix "/" $dest) }} + proxy_redirect ~^{{ $dest }}(.*)$ {{ .Path }}$1; {{- end }} set $upstream_keepalive {{ if ne $keepalive "disabled" }}true{{ else }}false{{ end }}; {{- end }}