Simplify RealIP middleware setup

This commit is contained in:
Deluan 2024-01-20 18:58:12 -05:00
parent b442736a0f
commit 34c29a156f
2 changed files with 11 additions and 7 deletions

View file

@ -164,18 +164,13 @@ func (s *Server) initRoutes() {
secureMiddleware(),
corsHandler(),
middleware.RequestID,
}
if conf.Server.ReverseProxyWhitelist == "" {
middlewares = append(middlewares, middleware.RealIP)
}
middlewares = append(middlewares,
realIPMiddleware,
middleware.Recoverer,
middleware.Heartbeat("/ping"),
robotsTXT(ui.BuildAssets()),
serverAddressMiddleware,
clientUniqueIDMiddleware,
)
}
// Mount the Native API /events endpoint with all middlewares, except the compress and request logger,
// adding the authentication middlewares