[英]Mac OS local proxy, connect ECONNREFUSED ::1:3000
I have a create-react-app app running on localhost:3000
and a proxy server running on localhost:4000
that redirects some of my request to port 3000.我有一个在localhost:3000
上运行的 create-react-app 应用程序和一个在localhost:4000
上运行的代理服务器,它将我的一些请求重定向到端口 3000。
Requesting localhost:3000/
correctly returns index.html file,请求localhost:3000/
正确返回 index.html 文件,
Requesting localhost:4000/
returns connect ECONNREFUSED::1:3000
with 502 code.请求localhost:4000/
返回connect ECONNREFUSED::1:3000
和 502 代码。
The exact same setup works properly on Ubuntu (returns index.html from localhost:4000) and Windows so I am sure proxy works fine.完全相同的设置在 Ubuntu(从 localhost:4000 返回 index.html)和 Windows 上正常工作,所以我确信代理工作正常。
Proxy is built using https://www.npmjs.com/package/http-proxy but i was unable to find any solution to this in documentation.代理是使用https://www.npmjs.com/package/http-proxy构建的,但我无法在文档中找到任何解决方案。
My question is: Does mac require changing some extra settings to allow this kind of traffic?我的问题是:mac 是否需要更改一些额外的设置才能允许这种流量?
One solution is to edit /etc/hosts
and remove ::1 localhost
mapping or change it to ::1 ip6-localhost
(default setting on ubuntu)一种解决方案是编辑/etc/hosts
并删除::1 localhost
映射或将其更改为::1 ip6-localhost
(ubuntu 上的默认设置)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.