mirror of
				https://github.com/ClusterCockpit/cc-backend
				synced 2025-10-30 23:45:06 +01:00 
			
		
		
		
	revert leftover notfoundhandler experiments
This commit is contained in:
		| @@ -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) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user