Browse Source

Adjusting how we handle IP address parsing to more gracefully handle X-Forwarded-For headers. Ref #1999

pull/2060/head
Jordan Wright 11 months ago
parent
commit
8b8e88b077
1 changed files with 1 additions and 6 deletions
  1. +1
    -6
      controllers/phish.go

+ 1
- 6
controllers/phish.go View File

@ -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)

Loading…
Cancel
Save