private ConnectionInfo parseXForwardedInfo(ConnectionInfo connectionInfo, HttpRequest request) {
        HttpHeaders headers = request.headers();
        String ipHeader = headers.get(X_FORWARDED_IP_HEADER);
        if (ipHeader != null) {
            connectionInfo = connectionInfo
                    .withRemoteAddress(AddressUtils.parseAddress(ipHeader.split(",", 2)[0],
                            connectionInfo.getRemoteAddress()
                                    .getPort()));
        } else if (isForwardedIpRequired) {
            throw new IllegalArgumentException(NO_FORWARDED_IP_ERROR_MESSAGE);
        }
        String protoHeader = headers.get(X_FORWARDED_PROTO_HEADER);
        if (protoHeader != null) {
            connectionInfo = connectionInfo.withScheme(protoHeader.split(",", 2)[0].trim());
        }
        String hostHeader = headers.get(X_FORWARDED_HOST_HEADER);
        if (hostHeader != null) {
            connectionInfo = connectionInfo
                    .withHostAddress(AddressUtils.parseAddress(hostHeader.split(",", 2)[0].trim(),
                            getDefaultHostPort(connectionInfo.getScheme()),
                            true));
        }

        String portHeader = headers.get(X_FORWARDED_PORT_HEADER);
        if (portHeader != null && !portHeader.isEmpty()) {
            String portStr = portHeader.split(",", 2)[0].trim();
            Integer port = IntUtil.tryParse(portStr);
            if (port == null) {
                throw new IllegalArgumentException(NO_FORWARDED_IP_ERROR_MESSAGE);
            }
            connectionInfo =
                    connectionInfo
                            .withHostAddress(
                                    AddressUtils.createUnresolved(connectionInfo.getHostAddress()
                                            .getHostString(), port),
                                    connectionInfo.getHostName(),
                                    port);
        }
        return connectionInfo;
    }
@author James Chen
@see reactor.netty.http.server.DefaultHttpForwardedHeaderHandler
turms-gateway/src/main/java/im/turms/gateway/access/client/websocket/HttpForwardedHeaderHandler.java