diff --git a/dingxin_toolbox_drf/http.py b/dingxin_toolbox_drf/http.py index af53586..2b608fd 100644 --- a/dingxin_toolbox_drf/http.py +++ b/dingxin_toolbox_drf/http.py @@ -10,11 +10,12 @@ class SetRemoteAddrFromForwardedFor(MiddlewareMixin): def process_request(self, request): print('process_request') try: - real_ip = request.META['HTTP_X_FORWARDED_FOR'] print("request.META") + real_ip = request.META['HTTP_X_FORWARDED_FOR'] print(request.META) print('real_ip', real_ip) except KeyError as err: + print('HTTP_X_FORWARDED_FOR key error') print(err) else: real_ip = real_ip.split(",")[0]