Skip to content

Commit

Permalink
chore(server): add x-forwarded-for/x-real-ip logging
Browse files Browse the repository at this point in the history
  • Loading branch information
luizfonseca committed Nov 28, 2023
1 parent c0b3e88 commit 3cd4e89
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internal/app/traefik-github-oauth-server/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ func NewDefaultApp() *App {
hlog.RefererHandler("referer"),
hlog.UserAgentHandler("userAgent"),
hlog.RequestIDHandler("requestId", "Request-Id"),
hlog.RemoteAddrHandler("ip"))
hlog.RemoteAddrHandler("ip"),
hlog.CustomHeaderHandler("xForwardedFor", "X-Forwarded-For"),
hlog.CustomHeaderHandler("xRealIp", "X-Real-Ip"),
)
// Recoverer middleware recovers from panics and writes a 500 if there was one.
router.Use(middleware.Recoverer)

Expand All @@ -103,7 +106,7 @@ func NewDefaultApp() *App {
ReadHeaderTimeout: 5 * time.Second,
},
router,
NewAuthRequestManager(cache.New(10*time.Minute, 30*time.Minute)),
NewAuthRequestManager(cache.New(5*time.Minute, 11*time.Minute)),
&logger,
)
}
Expand Down

0 comments on commit 3cd4e89

Please sign in to comment.