调试代码

main
RogerWork 8 months ago
parent 10cc34903f
commit d42861ce07
  1. 3
      dingxin_toolbox_drf/http.py

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

Loading…
Cancel
Save