Skip to content

http: fix perf_hooks detail.req.url port and proxied path#64311

Open
stefanobaghino wants to merge 1 commit into
nodejs:mainfrom
stefanobaghino:perf_hooks/fix-http-detail-url
Open

http: fix perf_hooks detail.req.url port and proxied path#64311
stefanobaghino wants to merge 1 commit into
nodejs:mainfrom
stefanobaghino:perf_hooks/fix-http-detail-url

Conversation

@stefanobaghino

Copy link
Copy Markdown

The detail.req.url reported on http performance entries for HttpClient misrepresents the request URL in two ways: the port is dropped when it is non-default (http://localhost:3000/foo is reported as http://localhost/foo), and when the request path has been rewritten to absolute-form for HTTP proxying it is appended to the protocol and hostname again (http://localhosthttp://localhost:3000/foo).

The URL is now built from the connection authority captured at request creation (which carries the non-default port and IPv6 brackets, same as the auto-generated Host header), and when the path has been rewritten to absolute-form for proxying it is reported as-is, since it is already the full normalized URL.

Fixes: #59625

The perf_hooks HTTP client entry built the reported URL from the bare hostname, dropping non-default ports and IPv6 brackets, and appended the request path even after it had been rewritten to absolute-form for proxying, duplicating the protocol and authority.

Report the connection authority captured at request creation and, for proxied requests, use the rewritten absolute-form target as-is.

Fixes: nodejs#59625
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/http
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added http Issues or PRs related to the http subsystem. needs-ci PRs that need a full CI run. labels Jul 5, 2026

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

http Issues or PRs related to the http subsystem. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port missing from url in http perf_hooks detail

3 participants