From b432eb016946595ee114d6c9b644369e754982f3 Mon Sep 17 00:00:00 2001 From: Matthew Irish Date: Mon, 15 Oct 2018 11:23:46 -0500 Subject: [PATCH 1/2] redirect ui to ui/ --- http/handler.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/http/handler.go b/http/handler.go index 6c9303d4ef..dcf25b9a07 100644 --- a/http/handler.go +++ b/http/handler.go @@ -126,7 +126,8 @@ func Handler(props *vault.HandlerProperties) http.Handler { } else { mux.Handle("/ui/", handleUIHeaders(core, handleUIStub())) } - mux.Handle("/", handleRootRedirect()) + mux.Handle("/", handleUIRedirect()) + mux.Handle("/ui", handleUIRedirect()) } additionalRoutes(mux, core) @@ -364,7 +365,7 @@ func handleUIStub() http.Handler { }) } -func handleRootRedirect() http.Handler { +func handleUIRedirect() http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { http.Redirect(w, req, "/ui/", 307) return From b2c7784d1e262c727519a69e64122eec2ac86a2b Mon Sep 17 00:00:00 2001 From: Matthew Irish Date: Mon, 15 Oct 2018 11:45:16 -0500 Subject: [PATCH 2/2] adjust prefix --- http/handler.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/http/handler.go b/http/handler.go index dcf25b9a07..f8e7a438c3 100644 --- a/http/handler.go +++ b/http/handler.go @@ -126,8 +126,8 @@ func Handler(props *vault.HandlerProperties) http.Handler { } else { mux.Handle("/ui/", handleUIHeaders(core, handleUIStub())) } - mux.Handle("/", handleUIRedirect()) mux.Handle("/ui", handleUIRedirect()) + mux.Handle("/", handleUIRedirect()) } additionalRoutes(mux, core) @@ -182,7 +182,7 @@ func wrapGenericHandler(core *vault.Core, h http.Handler, maxRequestSize int64, } r = newR - case strings.HasPrefix(r.URL.Path, "/ui/"), r.URL.Path == "/": + case strings.HasPrefix(r.URL.Path, "/ui"), r.URL.Path == "/": default: respondError(w, http.StatusNotFound, nil) cancelFunc()