mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
fix(mod): redirect dashboard to /dashboard
This commit is contained in:
parent
b4f3d02c1c
commit
64e49726cd
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user