Skip to content

Resolving localhost subdomains #16744

@JulianVennen

Description

@JulianVennen

When you try to resolve a domain within localhost (e.g. example.localhost) netty currently queries checks the hosts file and queries the DNS server if it isn't defined there. If the DNS server does not resolve the record then netty throws an unknown host exception. This was tested on MacOS with Netty 4.2.12.Final.

The correct behaviour is defined in RFC 6761 Section 6.3:

Name resolution APIs and libraries SHOULD recognize localhost
names as special and SHOULD always return the IP loopback address
for address queries and negative responses for all other query
types. Name resolution APIs SHOULD NOT send queries for
localhost names to their configured caching DNS server(s).

There already is an exception for resolving localhost specifically on Windows because it isn't in the hosts file (see #5410). Expanding that to apply to all subdomains of localhost on all systems would solve this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions