diff --git a/routers/routes/chi.go b/routers/routes/chi.go index 5ff7a728f..00689441b 100644 --- a/routers/routes/chi.go +++ b/routers/routes/chi.go @@ -230,6 +230,12 @@ func RegisterInstallRoute(c chi.Router) { m := NewMacaron() RegisterMacaronInstallRoute(m) + // We need at least one handler in chi so that it does not drop + // our middleware: https://github.com/go-gitea/gitea/issues/13725#issuecomment-735244395 + c.Get("/", func(w http.ResponseWriter, req *http.Request) { + m.ServeHTTP(w, req) + }) + c.NotFound(func(w http.ResponseWriter, req *http.Request) { m.ServeHTTP(w, req) })