Skip to content

fix(dns): skip lookup for IPv6 literal origins - #6061

Open
sebxt wants to merge 1 commit into
nodejs:mainfrom
sebxt:fix/dns-interceptor-ipv6-literal
Open

sebxt wants to merge 1 commit into
nodejs:mainfrom
sebxt:fix/dns-interceptor-ipv6-literal

Conversation

@sebxt

@sebxt sebxt commented Oct 20, 2026

Copy link
Copy Markdown

This relates to...

Requests through interceptors.dns() to an IPv6 literal origin, for example http://[::1]:3000, fail with getaddrinfo ENOTFOUND [::1].

Rationale

The interceptor already skips the lookup when the origin is an IP address, but it checks URL#hostname, which keeps the brackets for IPv6 ([::1]). net.isIP('[::1]') returns 0, so the bracketed literal was sent to lookup() and failed.

Changes

Strip the surrounding brackets from the hostname before calling isIP() in the dns interceptor, so IPv6 literals take the same pass through path as IPv4 literals.

Features

N/A

Bug Fixes

  • dns interceptor no longer performs a lookup for IPv6 literal origins.

Breaking Changes and Deprecations

N/A

Status

Fixes #6060

Signed-off-by: Sebastian Turner <sebastiant3484@gmail.com>
@codecov-commenter

codecov-commenter commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.57%. Comparing base (f4e4e45) to head (5b94333).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6061   +/-   ##
=======================================
  Coverage   91.57%   91.57%           
=======================================
  Files         113      113           
  Lines       43938    43944    +6     
=======================================
+ Hits        40235    40242    +7     
+ Misses       3703     3702    -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
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.

dns interceptor runs a DNS lookup for IPv6 literal origins and fails with ENOTFOUND

3 participants