Commit 9b3781a6 authored by 任文超's avatar 任文超

真实IP参数X-Original-Client-Ip跳过127.*.*.*的保留地址段

parent 18ed3477
...@@ -71,7 +71,7 @@ public class IPUtil { ...@@ -71,7 +71,7 @@ public class IPUtil {
*/ */
public static String getRemoteIP(HttpServletRequest request) { public static String getRemoteIP(HttpServletRequest request) {
String ip = request.getHeader("x-original-client-ip"); String ip = request.getHeader("x-original-client-ip");
if (ValidationUtil.validateIpv4(ip)) { if (ValidationUtil.validateIpv4(ip) && !ip.startsWith("127.")) {
return ip; return ip;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment