refactor: 指定合法代理ip解决无法在代理情况获取真实客户端ip问题

This commit is contained in:
2025-04-18 18:04:14 +08:00
parent b3fa7885a2
commit 840a008801
2 changed files with 10 additions and 0 deletions

View File

@@ -11,6 +11,9 @@ DB_PREFIX = ow_
DEFAULT_LANG = zh-cn DEFAULT_LANG = zh-cn
# 前端代理服务器ip影响使用代理访问情况下的客户端ip获取
PROXY_SERVER_IP[] = 120.79.27.160
[JWT] [JWT]
TTL=3600 TTL=3600
REFRESH_TTL=20160 REFRESH_TTL=20160

View File

@@ -4,5 +4,12 @@ namespace app;
// 应用请求对象类 // 应用请求对象类
class Request extends \think\Request class Request extends \think\Request
{ {
protected $proxyServerIp = [];
public function __construct()
{
parent::__construct();
// 设置前端代理服务器IP地址让代理访问情况下正确获取真实客户端IP地址
$this->proxyServerIp = env('PROXY_SERVER_IP', ['120.79.27.160']);
}
} }