nodejs / nodejs/undici

Add support for resolving wildcard subdomains *.localhost

Open
#4,391 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
7.7k
Forks
879
Avg merge
2d 16h
Merged PRs (30d)
68

Description

This would solve...

In popular browsers, subdomains of localhost (e.g. http://myserver.localhost) all resolve to loopback [::1, 127.0.0.1]. This is also also specified in the fetch spec.

References:

The implementation should look like...

Extract the public suffix, compare it to localhost and localhost. before calling dns.lookup.

I have also considered...

Additional context

This could also be a workaround for a bug resolving non-wildcard localhost itself #1602, since glibc getaddrinfo mistakenly filters out the localhost loopback ipv6 address when you pass in the ADDRCONFIG flag (https://sourceware.org/bugzilla/show_bug.cgi?id=14969).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the hostname-resolution path that calls dns.lookup, then compare its behavior with the Fetch specification and RFC 6761 references. Done means wildcard subdomains such as myserver.localhost resolve to loopback addresses before ordinary DNS lookup, with the relevant tests passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
backend-api-design, networking
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.