From 7881ce32b2636baecc3cff2d5b25e90110585bce Mon Sep 17 00:00:00 2001 From: peusebiu Date: Mon, 3 Jul 2023 17:13:15 +0300 Subject: [PATCH] fix(extensions): setup UI extension as last one (#1572) because UI routes will setup a http.FileServer on '/' any router setup after UI will be ignored at runtime becuase gorrilla will route it to http.Fileserver instead. Signed-off-by: Petu Eusebiu --- pkg/api/routes.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/api/routes.go b/pkg/api/routes.go index 6510c6f5..1ed03858 100644 --- a/pkg/api/routes.go +++ b/pkg/api/routes.go @@ -133,10 +133,12 @@ func (rh *RouteHandler) SetupRoutes() { ext.SetupUserPreferencesRoutes(rh.c.Config, prefixedExtensionsRouter, rh.c.StoreController, rh.c.RepoDB, rh.c.CveInfo, rh.c.Log) - ext.SetupUIRoutes(rh.c.Config, rh.c.Router, rh.c.StoreController, rh.c.Log) ext.SetupMetricsRoutes(rh.c.Config, rh.c.Router, rh.c.StoreController, AuthHandler(rh.c), rh.c.Log) gqlPlayground.SetupGQLPlaygroundRoutes(rh.c.Config, prefixedRouter, rh.c.StoreController, rh.c.Log) + + // last should always be UI because it will setup a http.FileServer and paths will be resolved by this FileServer. + ext.SetupUIRoutes(rh.c.Config, rh.c.Router, rh.c.StoreController, rh.c.Log) } } }