Skip to content

Subdomains on localhost return ENOTFOUND on some OS. #50871

Open
@spthiel

Description

@spthiel

Version

Tested on v21.2.0, v20.9.0, v18.18.2

Platform

Microsoft Windows NT 10.0.19045.0 x64

Subsystem

No response

What steps will reproduce the bug?

  1. run fetch("http://test.localhost/")

How often does it reproduce? Is there a required condition?

Happens on windows every time

What is the expected behavior? Why is that the expected behavior?

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

What do you see instead?

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'
  }
}

Additional information

Recreated locally in a VM but also on an actual Windows device

Metadata

Metadata

Assignees

No one assigned

    Labels

    dnsIssues and PRs related to the dns subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions