From c4cc36ec3ebe3915f7526d159895fc7269178f5d Mon Sep 17 00:00:00 2001 From: RogerWork Date: Wed, 20 Mar 2024 16:49:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E8=AF=95=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dingxin_toolbox_drf/http.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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]