Do not try to split ip and port of x-forwarded-for addresses
This commit is contained in:
@@ -28,7 +28,7 @@ func GetIPAddressFromRequest(req *http.Request) string {
|
|||||||
ipAddressString := req.RemoteAddr
|
ipAddressString := req.RemoteAddr
|
||||||
xForwardedFor := req.Header.Get("X-FORWARDED-FOR")
|
xForwardedFor := req.Header.Get("X-FORWARDED-FOR")
|
||||||
if xForwardedFor != "" {
|
if xForwardedFor != "" {
|
||||||
ipAddressString = xForwardedFor
|
return xForwardedFor
|
||||||
}
|
}
|
||||||
|
|
||||||
ip, _, err := net.SplitHostPort(ipAddressString)
|
ip, _, err := net.SplitHostPort(ipAddressString)
|
||||||
|
|||||||
Reference in New Issue
Block a user