Put notFoundHandler earlier to also catch subrouters

This commit is contained in:
2026-02-09 07:46:37 +01:00
parent a8194de492
commit c7b366f35f

View File

@@ -256,6 +256,10 @@ func (s *Server) init() error {
s.restAPIHandle.MountMetricStoreAPIRoutes(metricstoreapi) s.restAPIHandle.MountMetricStoreAPIRoutes(metricstoreapi)
// Set NotFound on the router so chi uses it for all unmatched routes,
// including those under subrouters like /api, /userapi, /frontend, etc.
s.router.NotFound(notFoundHandler)
if config.Keys.EmbedStaticFiles { if config.Keys.EmbedStaticFiles {
if i, err := os.Stat("./var/img"); err == nil { if i, err := os.Stat("./var/img"); err == nil {
if i.IsDir() { if i.IsDir() {