代理Localhost请求在Debian OS上使用nodejs使用PARCELJ时会遇到Econnreset错误
我在不同端口上有2个应用程序。
- API -http:// localhost:3000
- UI- http:// localhost:3001
UI通过。
我需要将UI应用程序(3001)的所有请求转发到API(3000)
我尝试使用.proxyrc方法 https://parcelceljs.s.org/features/features/deflovement/deflovement/#。 proxyrc-%2f-.proxyrc.json 使用下一个配置:
{
"/api": {
"target": "http://localhost:3000/",
"changeOrigin": true
}
}
const { createProxyMiddleware } = require("http-proxy-middleware")
module.exports = function (app) {
app.use(
createProxyMiddleware("/api", {
target: "http://localhost:3000/",
changeOrigin: true,
})
);
};
不幸的是,每次请求时我会遇到这样的错误:
console: [HPM] Error occurred while proxying request localhost:3001/api/v2/client-config to http://localhost:3000/ [ECONNRESET] (https://nodejs.org/api/errors.html#errors_common_system_errors)
其他带有Debian和其他Linuxes的团队成员没有此类问题。
有人可以帮我吗?
- OS:Debian GNU/Linux 11(Bullseye)
- NVM:0.39.1
- 节点:V14.18.2
- NPM:8.3.1
- HTTP-Proxy-Middleware: ^2.0.6
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论