From a175c332d1d9709e35b1ccdd7f81edefe1d38c37 Mon Sep 17 00:00:00 2001 From: RogerWork Date: Wed, 20 Mar 2024 16:46:31 +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 | 1 + dingxin_toolbox_drf/settings.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dingxin_toolbox_drf/http.py b/dingxin_toolbox_drf/http.py index 74fcd7a..af53586 100644 --- a/dingxin_toolbox_drf/http.py +++ b/dingxin_toolbox_drf/http.py @@ -8,6 +8,7 @@ class SetRemoteAddrFromForwardedFor(MiddlewareMixin): """ def process_request(self, request): + print('process_request') try: real_ip = request.META['HTTP_X_FORWARDED_FOR'] print("request.META") diff --git a/dingxin_toolbox_drf/settings.py b/dingxin_toolbox_drf/settings.py index af70d99..f80a8fe 100644 --- a/dingxin_toolbox_drf/settings.py +++ b/dingxin_toolbox_drf/settings.py @@ -88,10 +88,10 @@ MIDDLEWARE = [ 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', + 'dingxin_toolbox_drf.http.SetRemoteAddrFromForwardedFor', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', - 'dingxin_toolbox_drf.http.SetRemoteAddrFromForwardedFor', ] ROOT_URLCONF = 'dingxin_toolbox_drf.urls'