'api.openai.com', 'ntrans.xample.cn' => 'ntrans.xfyun.cn', ]; $host = $request->host(true); log::info('$host:'.$host); if (!isset($replace[$host])) { return $connection->send(response('404 not found', 404)); } $host = $replace[$host]; $buffer = (string)$request; $con = new AsyncTcpConnection("tcp://$host:443", ['ssl' =>[ 'verify_peer' => false ]]); $buffer = preg_replace("/Host: ?(.*?)\r\n/", "Host: $host\r\n", $buffer); $con->transport = 'ssl'; $connection->protocol = null; $con->send($buffer); $con->pipe($connection); $connection->pipe($con); $con->connect(); } }