diff --git a/pkg/api/router.go b/pkg/api/router.go index 83f80bb81e0..14c9ab05ee6 100644 --- a/pkg/api/router.go +++ b/pkg/api/router.go @@ -40,6 +40,23 @@ func (s *Service) Mount() { s.mountBusinessDebug() s.mountAPI() + s.Handler = web.ChainHandlers( + httpaccess.NewHTTPAccessLogHandler(s.logger, s.tracer, "api access"), + handlers.CompressHandler, + s.corsHandler, + web.NoCacheHeadersHandler, + web.FinalHandler(router), + ) +} + +// EnableFullAPI will enable all available endpoints, because some endpoints are not available during syncing. +func (s *Service) EnableFullAPI() { + if s == nil { + return + } + + s.fullAPIEnabled = true + compressHandler := func(h http.Handler) http.Handler { downloadEndpoints := []string{ "/bzz", @@ -86,15 +103,6 @@ func (s *Service) Mount() { ) } -// EnableFullAPI will enable all available endpoints, because some endpoints are not available during syncing. -func (s *Service) EnableFullAPI() { - if s == nil { - return - } - - s.fullAPIEnabled = true -} - func (s *Service) mountTechnicalDebug() { s.router.Handle("/node", jsonhttp.MethodHandler{ "GET": http.HandlerFunc(s.nodeGetHandler),