|
|
@ -10,11 +10,12 @@ class SetRemoteAddrFromForwardedFor(MiddlewareMixin): |
|
|
|
def process_request(self, request): |
|
|
|
def process_request(self, request): |
|
|
|
print('process_request') |
|
|
|
print('process_request') |
|
|
|
try: |
|
|
|
try: |
|
|
|
real_ip = request.META['HTTP_X_FORWARDED_FOR'] |
|
|
|
|
|
|
|
print("request.META") |
|
|
|
print("request.META") |
|
|
|
|
|
|
|
real_ip = request.META['HTTP_X_FORWARDED_FOR'] |
|
|
|
print(request.META) |
|
|
|
print(request.META) |
|
|
|
print('real_ip', real_ip) |
|
|
|
print('real_ip', real_ip) |
|
|
|
except KeyError as err: |
|
|
|
except KeyError as err: |
|
|
|
|
|
|
|
print('HTTP_X_FORWARDED_FOR key error') |
|
|
|
print(err) |
|
|
|
print(err) |
|
|
|
else: |
|
|
|
else: |
|
|
|
real_ip = real_ip.split(",")[0] |
|
|
|
real_ip = real_ip.split(",")[0] |
|
|
|