From d42861ce0775ee1210b7a343fcd84fb33b8fdc65 Mon Sep 17 00:00:00 2001 From: RogerWork Date: Wed, 20 Mar 2024 16:26:39 +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, 3 insertions(+) diff --git a/dingxin_toolbox_drf/http.py b/dingxin_toolbox_drf/http.py index b904ad3..ce1fae2 100644 --- a/dingxin_toolbox_drf/http.py +++ b/dingxin_toolbox_drf/http.py @@ -10,7 +10,10 @@ class SetRemoteAddrFromForwardedFor(MiddlewareMixin): def process_request(self, request): try: real_ip = request.META['HTTP_X_FORWARDED_FOR'] + print("request.META") + print(request.META) except KeyError as err: print(err) else: real_ip = real_ip.split(",")[0] + request.META['REMOTE_ADDR'] = real_ip