question: public boolean checkIfBehindNat ( String ipv4Str , String ipv6Str , String clientIp ) throws Exception { log . info ( String . format ( "Performing NAT check, client address connecting to VIP: %s. Client reports its IPv4 = %s, IPv6 = %s" , clientIp , ipv4Str , ipv6Str ) ) ; InetAddress ipv4Addr = parseInetAddress ( ipv4Str ) ; InetAddress ipv6Addr = parseInetAddress ( ipv6Str ) ; InetAddress directAddr = parseInetAddress ( clientIp ) ; if ( directAddr == null || ipv4Addr == null && ipv6Addr == null ) { String ipAddrsStr = StringUtils . join ( new String [ ] { ipv4Str , ipv6Str } , '|' ) ; log . error ( "checkParam is {}, X-Forwarded-For is {}" , ipAddrsStr , clientIp ) ; throw new Exception ( ipAddrsStr ) ; } return ! directAddr . equals ( ipv4Addr ) && ! directAddr . equals ( ipv6Addr ) ; }
target:  Compare IP addresses that web server is seeing(from X-Forwarded-For) with what client's real address. If they are different, it means client is behind NAT proxy