DNS resolution issue specific to Windows/Mac environments with localhost subdomains.
The issue involves inconsistent DNS resolution behavior for localhost subdomains on Windows/Mac compared to Linux. While workarounds exist, the core DNS resolution behavior in Node.js needs investigation. The challenge lies in platform-specific network stack behaviors.
Tested on v21.2.0, v20.9.0, v18.18.2
Microsoft Windows NT 10.0.19045.0 x64
No response
fetch("http://test.localhost/")Happens on windows every time
Expected behaviour is ECONNREFUSED or content of what the webpage contains equally to how a node on Linux, cURL or a browser would handle it
Uncaught [TypeError: fetch failed] {
cause: Error: getaddrinfo ENOTFOUND test.localhost
at GetAddrInfoReqWrap.onlookupall [as complete] (node:dns:118:26)
at GetAddrInfoReqWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'test.localhost'
}
}
Recreated locally in a VM but also on an actual Windows device
Claim this issue to let others know you're working on it. You'll earn 20 points when you complete it!