From 64e49726cd9ef7912a8017ccc668563568a5418c Mon Sep 17 00:00:00 2001 From: Brandon Philips Date: Sat, 23 Nov 2013 23:31:28 -0800 Subject: [PATCH] fix(mod): redirect dashboard to /dashboard --- mod/mod.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mod/mod.go b/mod/mod.go index 741b19002..454146221 100644 --- a/mod/mod.go +++ b/mod/mod.go @@ -3,6 +3,7 @@ package mod import ( "net/http" + "path" "github.com/coreos/etcd/mod/dashboard" "github.com/gorilla/mux" @@ -10,9 +11,16 @@ import ( var ServeMux *http.Handler +func addSlash(w http.ResponseWriter, req *http.Request) { + http.Redirect(w, req, path.Join("mod", req.URL.Path) + "/", 302) + return +} + func HttpHandler() (handler http.Handler) { modMux := mux.NewRouter() + modMux.HandleFunc("/dashboard", addSlash) modMux.PathPrefix("/dashboard/"). Handler(http.StripPrefix("/dashboard/", dashboard.HttpHandler())) + return modMux }