mirror of
https://github.com/prymitive/karma
synced 2026-08-17 11:27:01 +00:00
fix(backend): stop using middleware.RealIP
This commit is contained in:
committed by
Łukasz Mierzwa
parent
8b7cb01ab3
commit
5115b714a8
@@ -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
@@ -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 --
|
||||
|
||||
Reference in New Issue
Block a user