presto-main/src/main/java/io/prestosql/server/HttpRequestSessionContext.java/HttpRequestSessionContext/getRemoteUserAddress
class HttpRequestSessionContext:    private static String getRemoteUserAddress(HeaderSupport forwardedHeaderSupport, String xForwarderForHeader, String remoteAddess)
    {
        // TODO support 'Forwarder' header (here & where other X-Forwarder-* are supported)

        switch (forwardedHeaderSupport) {
            case WARN:
                if (xForwarderForHeader != null) {
                    log.warn("Unsupported HTTP header '%s'. Presto needs to be explicitly configured to %s or %s this header", X_FORWARDED_FOR, IGNORE, ACCEPT);
                }
                return remoteAddess;

            case IGNORE:
                return remoteAddess;

            case ACCEPT:
                if (xForwarderForHeader != null) {
                    List<String> addresses = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(xForwarderForHeader);
                    if (!addresses.isEmpty()) {
                        return addresses.get(0);
                    }
                }
                return remoteAddess;

            default:
                throw new UnsupportedOperationException("Unexpected forwardedHeaderSupport: " + forwardedHeaderSupport);
        }
    }