Skip to content

Commit

Permalink
redirect /ui and /index.html to the ui dashboard at /static/app/#/das…
Browse files Browse the repository at this point in the history
…hboard/
  • Loading branch information
mikedanese committed Jun 3, 2015
1 parent 3da686f commit a1ea672
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/ui/installsupport.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ import (
assetfs "github.com/elazarl/go-bindata-assetfs"
)

const dashboardPath = "/static/app/#/dashboard/"

type MuxInterface interface {
Handle(pattern string, handler http.Handler)
HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
}

func InstallSupport(mux MuxInterface, enableSwaggerSupport bool) {
Expand All @@ -38,6 +41,10 @@ func InstallSupport(mux MuxInterface, enableSwaggerSupport bool) {
fileServer := http.FileServer(&assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, Prefix: "www"})
prefix := "/static/"
mux.Handle(prefix, http.StripPrefix(prefix, fileServer))
prefix = "/ui/"
mux.HandleFunc(prefix, func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, dashboardPath, http.StatusTemporaryRedirect)
})

if enableSwaggerSupport {
// Expose files in third_party/swagger-ui/ on <host>/swagger-ui
Expand Down

0 comments on commit a1ea672

Please sign in to comment.