Replies: 15 comments 12 replies
-
终于找到相同问题的人了,这个问题从webpack到vite,一直存在。真的好烦啊! |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
有解决的吗??? |
Beta Was this translation helpful? Give feedback.
-
请问这个问题有解决方案吗?mac上遇到了相同的问题 |
Beta Was this translation helpful? Give feedback.
-
检查自己配置的代理的api 是否可行, ETIMEDOUT 一般因为代理请求此api 超时报错的,跟vite代理没关系 |
Beta Was this translation helpful? Give feedback.
-
@lokiwiki 目标api肯定是可用的,这个问题其实已经有很多mac的开发者遇到了。我最近也尝试去解决这个问题。当后台服务部署在ssd上,也就是说访问速度很快的时候,这个问题可以得到极大的缓解约等于没有。但是当网络环境比较复杂时或者部署在hdd上时候,总之就是所有可能导致api访问速度不快的时候,但绝对不是慢,届时就会出现这个问题。 |
Beta Was this translation helpful? Give feedback.
-
If you use a proxy that doesn’t use node/vite (golang, or caddy etc) does that work? Maybe a bug in http-proxy or http? I ran into problems using vite’s proxy so don’t use it anymore |
Beta Was this translation helpful? Give feedback.
-
兄弟们终于找到方法了,根据Tnon大佬给的方法。手动配置代理的agent,但是在我的环境上需要额外配置一些内容 完整的配置如下 const setupProxy = () => {
const httpOptions = {
target: 'http://xx.xx.xx.xxx:xx/',
changeOrigin: true,
agent: new HttpAgent({keepAlive: true, keepAliveMsecs: 20000})
}
return {
'/api': httpOptions
}
}
export default setupProxy |
Beta Was this translation helpful? Give feedback.
-
我最近升级了node版本之后也遇到了这个问题,搜索了之后 stackoverflow上的这个回答解决了我的问题。 |
Beta Was this translation helpful? Give feedback.
-
这个问题有没有关联的 issue 呢?看评论区的解决方案也挺麻烦的 |
Beta Was this translation helpful? Give feedback.
-
yarn add agent-base import http from "http"; 根据上面老哥的代码 这样添加后解决了问题 |
Beta Was this translation helpful? Give feedback.
-
根因是node 17以后修改了dns resolution order,默认将localhost解析为ipv6的": :1"。但如果你的后端服务监听地址是localhost:xxxx,这就导致了不匹配。解决办法有两个,我个人更倾向第二个:
|
Beta Was this translation helpful? Give feedback.
-
我草,终于找到组织了。解决了我这个问题。感谢🙏 |
Beta Was this translation helpful? Give feedback.
-
从 chimurai/http-proxy-middleware#710 追过来的 |
Beta Was this translation helpful? Give feedback.
-
解决了我这个问题。感谢🙏 |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
用proxy代理到k8s环境的后台服务(https),当然,后台服务能够正常使用。
{
changeOrigin: true,
secure: false,
target: ‘https://xxxx.com’
}
mac启动服务后,比如浏览器同时发送了10个请求,会有随机几个一直pending,不能返回数据。
windows环境没有这个问题。
控制台报错
[vite] http proxy error:
Error: connect ETIMEDOUT' xx.xx.xx.xx:443'
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16)
Reproduction
none
System Info
Used Package Manager
yarn
Logs
Validations
Beta Was this translation helpful? Give feedback.
All reactions