diff --git a/cmd/cc-backend/server.go b/cmd/cc-backend/server.go index da14e1e..62b9223 100644 --- a/cmd/cc-backend/server.go +++ b/cmd/cc-backend/server.go @@ -257,7 +257,7 @@ func serverInit() { router.PathPrefix("/img/").Handler(http.StripPrefix("/img/", http.FileServer(http.Dir("./var/img")))) } } - router.PathPrefix("/static/").Handler(http.StripPrefix("/static/", web.ServeFiles())) + router.PathPrefix("/").Handler(http.StripPrefix("/", web.ServeFiles())) } else { router.PathPrefix("/").Handler(http.FileServer(http.Dir(config.Keys.StaticFiles))) } @@ -270,14 +270,14 @@ func serverInit() { handlers.AllowedMethods([]string{"GET", "POST", "HEAD", "OPTIONS"}), handlers.AllowedOrigins([]string{"*"}))) - secured.NotFoundHandler = http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { - page := web.Page{ - Title: "ClusterCockpit - Not Found", - Build: buildInfo, - } - rw.Header().Add("Content-Type", "text/html; charset=utf-8") - web.RenderTemplate(rw, "404.tmpl", &page) - }) + // secured.NotFoundHandler = http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { + // page := web.Page{ + // Title: "ClusterCockpit - Not Found", + // Build: buildInfo, + // } + // rw.Header().Add("Content-Type", "text/html; charset=utf-8") + // web.RenderTemplate(rw, "404.tmpl", &page) + // }) // secured.NotFoundHandler = http.HandlerFunc(http.NotFound) // router.NotFoundHandler = router.NewRoute().HandlerFunc(http.NotFound).GetHandler() @@ -285,20 +285,20 @@ func serverInit() { // printEndpoints(router) } -func printEndpoints(r *mux.Router) { - r.Walk(func(route *mux.Route, router *mux.Router, ancestors []*mux.Route) error { - path, err := route.GetPathTemplate() - if err != nil { - path = "nopath" - } - methods, err := route.GetMethods() - if err != nil { - methods = append(methods, "nomethod") - } - fmt.Printf("%v %s\n", methods, path) - return nil - }) -} +// func printEndpoints(r *mux.Router) { +// r.Walk(func(route *mux.Route, router *mux.Router, ancestors []*mux.Route) error { +// path, err := route.GetPathTemplate() +// if err != nil { +// path = "nopath" +// } +// methods, err := route.GetMethods() +// if err != nil { +// methods = append(methods, "nomethod") +// } +// fmt.Printf("%v %s\n", methods, path) +// return nil +// }) +// } func serverStart() { handler := handlers.CustomLoggingHandler(io.Discard, router, func(_ io.Writer, params handlers.LogFormatterParams) {