nginx 多重代理 获取不到IP 啊= = 。

张益达仗义哒 发布于 2016/01/26 15:05
阅读 263
收藏 0

     nginx   多重代理     获取不到IP 啊= = 。

String ip = request.getHeader("x-forwarded-for");
//ip="211.100.51.5";
if (ip == null || ip.length() == 0
|| "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (ip == null || ip.length() == 0
|| "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (ip == null || ip.length() == 0
|| "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}



我是这样获取IP的

NGINX 端是这样

加载中
返回顶部
顶部