简体   繁体   中英

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.

Requesting localhost:3000/ correctly returns index.html file,

Requesting localhost:4000/ returns connect ECONNREFUSED::1:3000 with 502 code.

The exact same setup works properly on Ubuntu (returns index.html from localhost:4000) and Windows so I am sure proxy works fine.

Proxy is built using https://www.npmjs.com/package/http-proxy but i was unable to find any solution to this in documentation.

My question is: Does mac require changing some extra settings to allow this kind of traffic?

One solution is to edit /etc/hosts and remove ::1 localhost mapping or change it to ::1 ip6-localhost (default setting on ubuntu)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM