-
- Notifications
You must be signed in to change notification settings - Fork 33.8k
Closed
Labels
httpIssues or PRs related to the http subsystem.Issues or PRs related to the http subsystem.
Description
When using the object form of http.request and using an IPv6 address as a hostname, and using a non-standard port, the Host header is created incorrectly...
Example code:
http.request({ method: 'GET', hostname: '::1', port:'3000', path: '/api', }, (res) => { console.log(res.statusCode, res.body); }) .end()This triggers a HTTP request with:
GET /api HTTP/1.1 Host: ::1:3000 Compared to (for example) curl http://[::1]:3000/api, which does
GET /api HTTP/1.1 Host: [::1]:3000 For reference: https://tools.ietf.org/html/rfc7230#section-5.4
- Kudos to @mpotra for helping me debug this issue..
Metadata
Metadata
Assignees
Labels
httpIssues or PRs related to the http subsystem.Issues or PRs related to the http subsystem.