code: public static String getRealClientIpAddr(final Map<String, String> httpHeaders,
        final String remoteAddr) {
  
      // If some upstream device added an X-Forwarded-For header
      // use it for the client ip
      // This will support scenarios where load balancers or gateways
      // front the Azkaban web server and a changing Ip address invalidates the session
  
      String clientIp = httpHeaders.getOrDefault(X_FORWARDED_FOR_HEADER, null);
      if (clientIp == null) {
        clientIp = remoteAddr;
      } else {
        // header can contain comma separated list of upstream servers - get the first one
        final String[] ips = clientIp.split(",");
        clientIp = ips[0];
      }
  
      // Strip off port and only get IP address
      final String[] parts = clientIp.split(":");
      clientIp = parts[0];
  
      return clientIp;
    }
docs: Gets the actual client IP address inspecting the X-Forwarded-For HTTP header or using the
  provided 'remote IP address' from the low level TCP connection from the client.
  
  If multiple IP addresses are provided in the X-Forwarded-For header then the first one (first
  hop) is used
  
  @param httpHeaders List of HTTP headers for the current request
  @param remoteAddr The client IP address and port from the current request's TCP connection
  @return The actual client IP address