diff --git a/check_csrf.go b/check_csrf.go index aa7e4f8f..2cae65af 100644 --- a/check_csrf.go +++ b/check_csrf.go @@ -56,9 +56,9 @@ func CheckCSRF(r *http.Request) bool { if user == nil { user = &User{} } - ip := r.RemoteAddr + ip := GetRemoteIP(r) if ip, _, err = net.SplitHostPort(ip); err != nil { - ip = r.RemoteAddr + ip = GetRemoteIP(r) } Trail(CRITICAL, "Request failed Anti-CSRF protection from user:%s IP:%s", user.Username, ip) diff --git a/global.go b/global.go index 38255cd0..264de224 100644 --- a/global.go +++ b/global.go @@ -310,7 +310,6 @@ var LogHTTPRequests = true /* HTTPLogFormat is the format used to log HTTP access %a: Client IP address -%{remote}p: Client port %A: Server hostname/IP %{local}p: Server port %U: Path diff --git a/log.go b/log.go index 746e2c00..149282ac 100644 --- a/log.go +++ b/log.go @@ -159,7 +159,7 @@ func (l *Log) SignIn(user string, action Action, r *http.Request) (err error) { loginStatus = r.Context().Value(CKey("login-status")).(string) } jsonifyValue := map[string]string{ - "IP": r.RemoteAddr, + "IP": GetRemoteIP(r), "Login-Status": loginStatus, } for k, v := range r.Header { @@ -178,7 +178,7 @@ func (l *Log) PasswordReset(user string, action Action, r *http.Request) (err er l.Username = user l.Action = action jsonifyValue := map[string]string{ - "IP": r.RemoteAddr, + "IP": GetRemoteIP(r), "Reset-Status": r.FormValue("reset-status"), } for k, v := range r.Header {