Java EE通过代理获取IP

时间:2015-02-20 17:19:54

标签: java java-ee servlets

如果那个人正在使用“ultrasurf”或任何其他程序,有没有办法让某人知识产权?

到目前为止,我得到了这段代码:

String ip = request.getHeader("X-Forwarded-For");
    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.getHeader("HTTP_CLIENT_IP");
    }
 if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
        ip = request.getHeader("HTTP_X_FORWARDED_FOR");
    }
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
        ip = request.getRemoteAddr();
    }

我错过了一些标题吗?

1 个答案:

答案 0 :(得分:2)

不,它无法获得原始IP。

对于隐藏在匿名网络,公司代理或家中简单路由器后面的用户都没有。