fix(backend): stop using middleware.RealIP

This commit is contained in:
Lukasz Mierzwa
2026-05-26 14:47:05 +01:00
committed by Łukasz Mierzwa
parent 8b7cb01ab3
commit 5115b714a8
3 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -71,7 +71,7 @@ func promMiddleware(next http.Handler) http.Handler {
if config.Config.Log.Requests {
slog.Info(
"Request completed",
slog.String("address", r.RemoteAddr),
slog.String("address", middleware.GetClientIP(r.Context())),
slog.String("path", r.URL.RequestURI()),
slog.String("duration", time.Since(start).String()),
slog.String("method", r.Method),
+1 -1
View File
@@ -80,8 +80,8 @@ func setupRouter(router *chi.Mux, historyPoller *historyPoller) {
_ = mime.AddExtensionType(".ico", "image/x-icon")
router.Use(proxyPathFixMiddleware)
router.Use(middleware.ClientIPFromRemoteAddr)
router.Use(promMiddleware)
router.Use(middleware.RealIP)
compressor := middleware.NewCompressor(flate.DefaultCompression)
router.Use(compressor.Handler)
@@ -3,8 +3,8 @@
exec bash -x ./test.sh &
exec karma --pid-file=karma.pid --alertmanager.uri=http://127.0.0.1:7035 --listen.address=127.0.0.1 --listen.port=8035 --log.requests
! stdout .
stderr 'level=INFO msg="Request completed" address=127.0.0.1:[0-9]+ path=/alerts.json duration=.+ method=POST code=200 bytes=[0-9]+'
stderr 'level=INFO msg="Request completed" address=127.0.0.1:[0-9]+ path=/alerts.json duration=.+ method=POST code=200 bytes=[0-9]+'
stderr 'level=INFO msg="Request completed" address=127.0.0.1 path=/alerts.json duration=.+ method=POST code=200 bytes=[0-9]+'
stderr 'level=INFO msg="Request completed" address=127.0.0.1 path=/alerts.json duration=.+ method=POST code=200 bytes=[0-9]+'
wait
-- test.sh --