feat: use resolved client IP in request and auth logs
Add a ClientIP middleware that resolves the client address once per request and stores it in the context, placed ahead of logging in the route chain. The request-logging middleware and both login-attempt logs now read the resolved address instead of the raw peer. Behind a trusted proxy these records show the real client; a direct, untrusted client still shows its own address and cannot forge one. Removes the local host:port helper now that the clientip package owns that parsing. Model: opus-4-8
This commit is contained in:
@@ -18,6 +18,7 @@ func (s *Server) SetupRoutes() {
|
||||
|
||||
s.router.Use(middleware.Recoverer)
|
||||
s.router.Use(middleware.RequestID)
|
||||
s.router.Use(s.mw.ClientIP())
|
||||
s.router.Use(s.mw.SecurityHeaders())
|
||||
s.router.Use(s.mw.Logging())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user