From 8216e113e8b19b6c431496626a21f3c41dfe349e Mon Sep 17 00:00:00 2001 From: linweizhe Date: Mon, 8 Apr 2024 21:58:58 +0800 Subject: [PATCH] correctly handle redirect logic for path-base routing --- nginx.tmpl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nginx.tmpl b/nginx.tmpl index fefb07f..ff04268 100644 --- a/nginx.tmpl +++ b/nginx.tmpl @@ -276,6 +276,9 @@ grpc_pass {{ trim $proto }}://{{ trim $upstream }}; {{- else }} proxy_pass {{ trim $proto }}://{{ trim $upstream }}{{ trim $dest }}; + {{- if not (eq .Path "/") }} + proxy_redirect ~^/(.*)$ {{ trimSuffix `/` .Path }}/$1; + {{- end }} set $upstream_keepalive {{ if ne $keepalive "disabled" }}true{{ else }}false{{ end }}; {{- end }}