Plugins: Preserve trailing slash in plugin proxy (#86859)

* Plugins: Preserve trailing slash in plugin proxy

* enable toggle by default
This commit is contained in:
Marcus Efraimsson
2024-06-05 13:36:14 +02:00
committed by GitHub
parent 17f03882d4
commit fe3e5917f1
11 changed files with 72 additions and 1 deletions
+6
View File
@@ -6,6 +6,7 @@ import (
"io"
"net/http"
"net/url"
"strings"
"go.opentelemetry.io/otel/attribute"
@@ -76,7 +77,12 @@ func (proxy *PluginProxy) HandleRequest() {
}
if path, exists := params["*"]; exists {
hasSlash := strings.HasSuffix(proxy.proxyPath, "/")
proxy.proxyPath = path
if hasSlash && !strings.HasSuffix(path, "/") && proxy.features.IsEnabled(proxy.ctx.Req.Context(), featuremgmt.FlagPluginProxyPreserveTrailingSlash) {
proxy.proxyPath += "/"
}
} else {
proxy.proxyPath = ""
}