From 8b8e88b0773956eeeb2202871ec2c2076e36f920 Mon Sep 17 00:00:00 2001 From: Jordan Wright Date: Wed, 14 Oct 2020 20:35:32 -0500 Subject: [PATCH] Adjusting how we handle IP address parsing to more gracefully handle X-Forwarded-For headers. Ref #1999 --- controllers/phish.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/controllers/phish.go b/controllers/phish.go index 8ca45a4e..71b25a87 100644 --- a/controllers/phish.go +++ b/controllers/phish.go @@ -360,12 +360,7 @@ func setupContext(r *http.Request) (*http.Request, error) { } ip, _, err := net.SplitHostPort(r.RemoteAddr) if err != nil { - log.Error(err) - return r, err - } - // Respect X-Forwarded headers - if fips := r.Header.Get("X-Forwarded-For"); fips != "" { - ip = strings.Split(fips, ", ")[0] + ip = r.RemoteAddr } // Handle post processing such as GeoIP err = rs.UpdateGeo(ip)