diff --git a/server/http_handler.go b/server/http_handler.go index 0226483..f94a260 100644 --- a/server/http_handler.go +++ b/server/http_handler.go @@ -44,15 +44,18 @@ func NewHoustonHandler() HoustonServerWithHandler { func (h *houstonHandler) RegisterHandlers(serveMux *http.ServeMux, prefix string) error { logger.Println("houstonHandler registed") - serveMux.Handle("/"+path.Join(prefix, "houston"), h) + if len(prefix) > 0 { + prefix = "/" + prefix + } + serveMux.Handle(prefix, h) fsx := http.FileServer(http.Dir("deploys")) - serveMux.Handle(fmt.Sprintf("/%s/deploys/", prefix), http.StripPrefix(fmt.Sprintf("/%s/deploys/", prefix), fsx)) + serveMux.Handle(fmt.Sprintf("%s/deploys/", prefix), http.StripPrefix(fmt.Sprintf("%s/deploys/", prefix), fsx)) ufsx := http.FileServer(http.Dir("downloads")) - serveMux.Handle(fmt.Sprintf("/%s/houston/downloads/", prefix), http.StripPrefix(fmt.Sprintf("/%s/houston/downloads/", prefix), ufsx)) + serveMux.Handle(fmt.Sprintf("%s/downloads/", prefix), http.StripPrefix(fmt.Sprintf("%s/downloads/", prefix), ufsx)) - serveMux.HandleFunc("/"+path.Join(prefix, "upload"), func(w http.ResponseWriter, r *http.Request) { + serveMux.HandleFunc(fmt.Sprintf("%s/upload", prefix), func(w http.ResponseWriter, r *http.Request) { defer func() { s := recover() if s != nil {