Skip to content

Add system property to disable RFC 6761 localhost resolution - #17100

Merged
normanmaurer merged 6 commits into
netty:4.2from
BoxJReilly:localhost_sysprop
Aug 7, 2026
Merged

normanmaurer merged 6 commits into
netty:4.2from
BoxJReilly:localhost_sysprop

Conversation

@BoxJReilly

Copy link
Copy Markdown
Contributor

Motivation:
Commit a6aeb6d (#16749) resolves localhost and *.localhost to loopback without querying DNS per RFC 6761. Some deployment environments use *.localhost hostnames that should resolve via DNS to non-loopback addresses.

Modifications:

Result:
Applications can opt out of automatic loopback resolution for .localhost hostnames by setting the system property to false.

Fixes
This fixes the scenario where *.localhost is used for non-loopback addresses, e.g. as an entrypoint into a service mesh.

Motivation:

Commit a6aeb6d (netty#16749) resolves localhost and *.localhost to loopback
without querying DNS per RFC 6761. Some deployment environments use
*.localhost hostnames that should resolve via DNS to non-loopback
addresses.

Modifications:

- Add -Dio.netty.resolver.dns.resolveLocalhostWithoutDns (default true)
- When false, restore pre-netty#16749 behavior where only Windows localhost
  and the Windows machine hostname are short-circuited to loopback
- Add tests verifying *.localhost falls through to DNS when disabled

Result:

Applications can opt out of automatic loopback resolution for .localhost
hostnames by setting the system property to false.
@normanmaurer

Copy link
Copy Markdown
Member

@testlens-app

testlens-app Bot commented Aug 4, 2026 •

Copy link
Copy Markdown

✅ All tests passed ✅

⚠️ TestLens detected flakiness ⚠️

Test Summary

Build PR / macos-aarch64-java11-boringssl build > Netty/Transport/Native/KQueue

Test Runs Flakiness
KQueueDatagramUnicastIPv6MappedTest > testSimpleSendWithConnect(TestInfo) 🚫 ❌ ✅ 3% 🟡

🏷️ Commit: ca87c80
▶️ Tests: 812 executed
🟡 Checks: 22/24 completed


Learn more about TestLens at testlens.app.

@BoxJReilly

Copy link
Copy Markdown
Contributor Author

@BoxJReilly did you sign our icla yet ? https://netty.io/s/icla

I have not signed it yet. I will have a look.

@BoxJReilly

Copy link
Copy Markdown
Contributor Author

@BoxJReilly did you sign our icla yet ? https://netty.io/s/icla

I have not signed it yet. I will have a look.

Sorry for the delay. It is submitted now.

@normanmaurer normanmaurer added this to the 4.2.18.Final milestone Aug 7, 2026
@normanmaurer normanmaurer added needs-cherry-pick-4.1 This PR should be cherry-picked to 4.1 once merged. needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. labels Aug 7, 2026
@normanmaurer
normanmaurer merged commit 14c628f into netty:4.2 Aug 7, 2026
38 of 39 checks passed
@normanmaurer

Copy link
Copy Markdown
Member

@BoxJReilly thanks a lot!

@netty-project-bot

Copy link
Copy Markdown
Contributor

Auto-port PR for 4.1: #17230

@github-actions github-actions Bot removed the needs-cherry-pick-4.1 This PR should be cherry-picked to 4.1 once merged. label Aug 7, 2026
@netty-project-bot

Copy link
Copy Markdown
Contributor

Auto-port PR for 5.0: #17231

@github-actions github-actions Bot removed the needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. label Aug 7, 2026
normanmaurer added a commit that referenced this pull request Aug 7, 2026
…lution (#17230)

Auto-port of #17100 to 4.1
Cherry-picked commit: 14c628f

---
Motivation:
Commit a6aeb6d (#16749) resolves localhost and *.localhost to loopback
without querying DNS per RFC 6761. Some deployment environments use
*.localhost hostnames that should resolve via DNS to non-loopback
addresses.

Modifications:
- Add -Dio.netty.resolver.dns.resolveLocalhostWithoutDns (default true)
- When false, restore pre-#16749 behavior where only Windows localhost
and the Windows machine hostname are short-circuited to loopback
- Add tests verifying *.localhost falls through to DNS when disabled

Result:
Applications can opt out of automatic loopback resolution for .localhost
hostnames by setting the system property to false.

Fixes 
This fixes the scenario where *.localhost is used for non-loopback
addresses, e.g. as an entrypoint into a service mesh.

---------

Co-authored-by: John Reilly <[email protected]>
Co-authored-by: Chris Vest <[email protected]>
Co-authored-by: Norman Maurer <[email protected]>
normanmaurer pushed a commit that referenced this pull request Aug 7, 2026
…lution (#17231)

Auto-port of #17100 to 5.0
Cherry-picked commit: 14c628f

---
Motivation:
Commit a6aeb6d (#16749) resolves localhost and *.localhost to loopback
without querying DNS per RFC 6761. Some deployment environments use
*.localhost hostnames that should resolve via DNS to non-loopback
addresses.

Modifications:
- Add -Dio.netty.resolver.dns.resolveLocalhostWithoutDns (default true)
- When false, restore pre-#16749 behavior where only Windows localhost
and the Windows machine hostname are short-circuited to loopback
- Add tests verifying *.localhost falls through to DNS when disabled

Result:
Applications can opt out of automatic loopback resolution for .localhost
hostnames by setting the system property to false.

Fixes 
This fixes the scenario where *.localhost is used for non-loopback
addresses, e.g. as an entrypoint into a service mesh.

Co-authored-by: John Reilly <[email protected]>
Co-authored-by: Chris Vest <[email protected]>
@normanmaurer normanmaurer mentioned this pull request Oct 1, 2026
lltopk pushed a commit to lltopk/netty that referenced this pull request Oct 24, 2026
…lution (netty#17230)

Auto-port of netty#17100 to 4.1
Cherry-picked commit: 14c628f

---
Motivation:
Commit a6aeb6d (netty#16749) resolves localhost and *.localhost to loopback
without querying DNS per RFC 6761. Some deployment environments use
*.localhost hostnames that should resolve via DNS to non-loopback
addresses.

Modifications:
- Add -Dio.netty.resolver.dns.resolveLocalhostWithoutDns (default true)
- When false, restore pre-netty#16749 behavior where only Windows localhost
and the Windows machine hostname are short-circuited to loopback
- Add tests verifying *.localhost falls through to DNS when disabled

Result:
Applications can opt out of automatic loopback resolution for .localhost
hostnames by setting the system property to false.

Fixes 
This fixes the scenario where *.localhost is used for non-loopback
addresses, e.g. as an entrypoint into a service mesh.

---------

Co-authored-by: John Reilly <[email protected]>
Co-authored-by: Chris Vest <[email protected]>
Co-authored-by: Norman Maurer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants