From 1c1000465ecf30c2e66cf2fd5ea6d98c303055ed Mon Sep 17 00:00:00 2001 From: lau572 <1010031226@qq.com> Date: Sat, 30 Mar 2024 17:44:47 +0800 Subject: [PATCH] =?UTF-8?q?=E9=89=B4=E6=9D=83=E8=8E=B7=E5=8F=96ip=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ruoyi/framework/config/SecurityConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java index 9d288e65..046648e7 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -69,7 +69,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override public boolean matches(HttpServletRequest request) { // 获取请求的IP - String requestIP = request.getRemoteAddr(); + String requestIP = request.getHeader("X-Forwarded-For"); // 将配置文件中的IP字符串分割为数组 String[] ips = allowedIPs.split(","); // 检查请求的IP是否在允许的IP数组中