Pre Merge pull request !366 from lihy2021/N/A

This commit is contained in:
lihy2021 2022-05-01 12:24:08 +00:00 committed by Gitee
commit a9287408ae
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -25,6 +25,13 @@ public class IpUtils
return "unknown";
}
String ip = request.getHeader("x-forwarded-for");
if (StringUtils.isNotEmpty(ip) && !"unknown".equalsIgnoreCase(ip))
{
if (ip.indexOf(",") != -1)
{
ip = ip.split(",")[0];
}
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
{
ip = request.getHeader("Proxy-Client-IP");