diff --git a/controllers/phish.go b/controllers/phish.go index 68701dda..8ca45a4e 100644 --- a/controllers/phish.go +++ b/controllers/phish.go @@ -121,6 +121,10 @@ func (ps *PhishingServer) registerRoutes() { gzipWrapper, _ := gziphandler.NewGzipLevelHandler(gzip.BestCompression) 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 phishHandler = handlers.CombinedLoggingHandler(log.Writer(), phishHandler) ps.server.Handler = phishHandler diff --git a/controllers/route.go b/controllers/route.go index d75d981c..6ea299c8 100644 --- a/controllers/route.go +++ b/controllers/route.go @@ -161,6 +161,10 @@ func (as *AdminServer) registerRoutes() { gzipWrapper, _ := gziphandler.NewGzipLevelHandler(gzip.BestCompression) 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 adminHandler = handlers.CombinedLoggingHandler(log.Writer(), adminHandler) as.server.Handler = adminHandler