From acdfc632d5f800fddcc7d945c462b8784aeaf10a Mon Sep 17 00:00:00 2001 From: jsasg <735273025@qq.com> Date: Fri, 18 Apr 2025 18:04:14 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=8C=87=E5=AE=9A=E5=90=88?= =?UTF-8?q?=E6=B3=95=E4=BB=A3=E7=90=86ip=E8=A7=A3=E5=86=B3=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E5=9C=A8=E4=BB=A3=E7=90=86=E6=83=85=E5=86=B5=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=9C=9F=E5=AE=9E=E5=AE=A2=E6=88=B7=E7=AB=AFip?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.dev | 3 +++ app/Request.php | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/.env.dev b/.env.dev index 957c6e5e..b5ddd24b 100644 --- a/.env.dev +++ b/.env.dev @@ -11,6 +11,9 @@ DB_PREFIX = ow_ DEFAULT_LANG = zh-cn +# 前端代理服务器ip(影响使用代理访问情况下的客户端ip获取) +PROXY_SERVER_IP[] = 120.79.27.160 + [JWT] TTL=3600 REFRESH_TTL=20160 diff --git a/app/Request.php b/app/Request.php index fc9aba06..3a5d1ea1 100644 --- a/app/Request.php +++ b/app/Request.php @@ -4,5 +4,12 @@ namespace app; // 应用请求对象类 class Request extends \think\Request { + protected $proxyServerIp = []; + public function __construct() + { + parent::__construct(); + // 设置前端代理服务器IP地址,让代理访问情况下,正确获取真实客户端IP地址 + $this->proxyServerIp = env('PROXY_SERVER_IP', ['120.79.27.160']); + } }