From af506dd26f486af5d6d7f615fa537536687ba9a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Pa=C3=9F?= <22845248+mpass99@users.noreply.github.com> Date: Mon, 11 Oct 2021 20:44:19 +0200 Subject: [PATCH] Fix Bug that only runner routes get registered with authorization. --- internal/api/api.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/api/api.go b/internal/api/api.go index b937691..b77f970 100644 --- a/internal/api/api.go +++ b/internal/api/api.go @@ -34,6 +34,10 @@ func NewRouter(runnerManager runner.Manager, environmentManager environment.Mana // configureV1Router configures a given router with the routes of version 1 of the Poseidon API. func configureV1Router(router *mux.Router, runnerManager runner.Manager, environmentManager environment.Manager) { + router.NotFoundHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + log.WithField("request", r).Debug("Not Found Handler") + w.WriteHeader(http.StatusNotFound) + }) v1 := router.PathPrefix(BasePath).Subrouter() v1.HandleFunc(HealthPath, Health).Methods(http.MethodGet) @@ -50,7 +54,7 @@ func configureV1Router(router *mux.Router, runnerManager runner.Manager, environ // All routes added to v1 after this require authentication. authenticatedV1Router := v1.PathPrefix("").Subrouter() authenticatedV1Router.Use(auth.HTTPAuthenticationMiddleware) - runnerController.ConfigureRoutes(authenticatedV1Router) + configureRoutes(authenticatedV1Router) } else { configureRoutes(v1) }