mirror of https://github.com/gophish/gophish
Adds support for X-Forwarded-For and X-Real-IP headers so that the correct IP address shows up in the logs.
Fixes #1999pull/2060/head
parent
3c490dbadb
commit
af3122f93b
|
@ -121,6 +121,10 @@ func (ps *PhishingServer) registerRoutes() {
|
||||||
gzipWrapper, _ := gziphandler.NewGzipLevelHandler(gzip.BestCompression)
|
gzipWrapper, _ := gziphandler.NewGzipLevelHandler(gzip.BestCompression)
|
||||||
phishHandler := gzipWrapper(router)
|
phishHandler := gzipWrapper(router)
|
||||||
|
|
||||||
|
// Respect X-Forwarded-For and X-Real-IP headers in case we're behind a
|
||||||
|
// reverse proxy.
|
||||||
|
phishHandler = handlers.ProxyHeaders(phishHandler)
|
||||||
|
|
||||||
// Setup logging
|
// Setup logging
|
||||||
phishHandler = handlers.CombinedLoggingHandler(log.Writer(), phishHandler)
|
phishHandler = handlers.CombinedLoggingHandler(log.Writer(), phishHandler)
|
||||||
ps.server.Handler = phishHandler
|
ps.server.Handler = phishHandler
|
||||||
|
|
|
@ -161,6 +161,10 @@ func (as *AdminServer) registerRoutes() {
|
||||||
gzipWrapper, _ := gziphandler.NewGzipLevelHandler(gzip.BestCompression)
|
gzipWrapper, _ := gziphandler.NewGzipLevelHandler(gzip.BestCompression)
|
||||||
adminHandler = gzipWrapper(adminHandler)
|
adminHandler = gzipWrapper(adminHandler)
|
||||||
|
|
||||||
|
// Respect X-Forwarded-For and X-Real-IP headers in case we're behind a
|
||||||
|
// reverse proxy.
|
||||||
|
adminHandler = handlers.ProxyHeaders(adminHandler)
|
||||||
|
|
||||||
// Setup logging
|
// Setup logging
|
||||||
adminHandler = handlers.CombinedLoggingHandler(log.Writer(), adminHandler)
|
adminHandler = handlers.CombinedLoggingHandler(log.Writer(), adminHandler)
|
||||||
as.server.Handler = adminHandler
|
as.server.Handler = adminHandler
|
||||||
|
|
Loading…
Reference in New Issue