mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 19:17:58 +00:00
UI: Trim trailing slashes to avoid redirects (#4668)
This commit is contained in:
@@ -273,6 +273,11 @@ func handleUIHeaders(core *vault.Core, h http.Handler) http.Handler {
|
||||
|
||||
func handleUI(h http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||
|
||||
// The fileserver handler strips trailing slashes and does a redirect.
|
||||
// We don't want the redirect to happen so we preemptively trim the slash
|
||||
// here.
|
||||
req.URL.Path = strings.TrimSuffix(req.URL.Path, "/")
|
||||
h.ServeHTTP(w, req)
|
||||
return
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user