Use localhost instead of 0.0.0.0 for local connections#300
Use localhost instead of 0.0.0.0 for local connections#300sangaline wants to merge 1 commit intojoeferner:masterfrom
Conversation
|
Hm ... waaaiiitt ... It's not that easy! Nodejs 18 changed the order of node.js dns lookups to resolve IPv6 over IPv4. When you change it to localhost then you most likely end up in ipv6 only ... so this change might have other side effects and should be considered carefully. Right binding to 0.0.0.0 means "bind ipv4 only". I do not know what happens if you bind to localhost ... does that now (nodejs 18+) mean you bind ipv6 only? or some mixture? |
|
what about 127.0.0.1 ? it resolve to localhost and ipv4. |
|
I see this must be a problem (not a PROBLEM) because the PR was rejected and I'm just now creating a fork to change the code and make it work for the Windows proxied target environment my VS Code extension needs to be deployed in I'd like to live close to the main branch so I give you an idea. Why not putting 0.0.0.0 by default and allow clients to set a custom value?. That is a no risk solution I suppose the other occurrences of 0.0.0.0 should be treated the same way (I'm going to do so in my fork). If not, please tell me Great code. Thank you NOTE: The commit referenced bellow was to try what @doaortu proposed. It didn't work until I changed it to localhost, the @sangaline's solution |
0.0.0.0 only works on Linux so it's changed by 127.0.0.1 (this fork was born from a rejected PR: joeferner#300)
This addresses the issue in #296. Connecting to
0.0.0.0only works on Linux, it results inPROXY_TO_PROXY_SOCKET_ERROR on : Error: connect ECONNREFUSEDerrors on MacOS and Windows. There's some discussion of this in nodejs/node#14900. This PR changes the target host from0.0.0.0tolocalhostin order to make it more cross-platform compatible.