public static String getClientIPByHeader(HttpServletRequest request, String... headerNames) {
		String ip;
		for (String header : headerNames) {
			ip = request.getHeader(header);
			if (false == isUnknow(ip)) {
				return getMultistageReverseProxyIp(ip);
			}
		}

		ip = request.getRemoteAddr();
		return getMultistageReverseProxyIp(ip);
	}
public static String getClientIPByHeader ( HttpServletRequest request , String ... headerNames ) { String ip ; for ( String header : headerNames ) { ip = request . getHeader ( header ) ; if ( false == isUnknow ( ip ) ) { return getMultistageReverseProxyIp ( ip ) ; } } ip = request . getRemoteAddr ( ) ; return getMultistageReverseProxyIp ( ip ) ; }
获取客户端IP

<p>
headerNames参数用于自定义检测的Header<br>
需要注意的是，使用此方法获取的客户IP地址必须在Http服务器（例如Nginx）中配置头信息，否则容易造成IP伪造。
</p>

@param request 请求对象{@link HttpServletRequest}
@param headerNames 自定义头，通常在Http服务器（例如Nginx）中配置
@return IP地址
@since 4.4.1