Handle ports in X Forwarded For (#4539)
parent
43c07a9b1c
commit
70181a3799
|
@ -26,7 +26,7 @@ def get_client_ip(request):
|
|||
# Get the original IP address (eg. "X-Forwarded-For: client, proxy1, proxy2")
|
||||
x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR', '').split(',')[0]
|
||||
if x_forwarded_for:
|
||||
ip_address = x_forwarded_for
|
||||
ip_address = x_forwarded_for.rsplit(':')[0]
|
||||
|
||||
return ip_address
|
||||
|
||||
|
|
Loading…
Reference in New Issue