You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用ngrok时Socket.io握手失败,如何解决ERR_NAME_NOT_RESOLVED错误?

修复方案

看错误请求URL http://%20https/socket.io/?EIO=4&transport=polling&t=OW0nMsS 里的%20,这是空格的URL编码,问题根源是你写ngrok地址时开头多了一个空格:

原错误代码:

socketClient.connect(" https://ed076d74586e.ngrok.app")

把开头的空格删除,改成:

socketClient.connect("https://ed076d74586e.ngrok.app")

修改后地址就能被正确解析,不会把空格和https错误识别成域名部分。另外可以确认下ngrok是否正确映射了本地1337端口(比如运行ngrok http 1337),确保生成的地址本身可正常访问。

内容的提问来源于stack exchange,提问作者guerrillacodester

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.22 10:52:14