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数组中