Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Node 18.18.2 : unable to override the Host header in fetch #50305

Copy link
Copy link

Description

@fieteboerner
Issue body actions

Version

v18.18.2

Platform

Linux hostname 5.15.131-1-MANJARO #1 SMP PREEMPT Thu Sep 7 11:05:18 UTC 2023 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

fetch("https://postman-echo.com/get", {
    headers: {
        Test: 1234,
        Host: "foo.postman-echo.com",
    },
})
    .then((r) => {
        return r.text();
    })
    .then((text) => console.log(text))
    .catch((e) => {
        console.log(e);
    });

run this code

The test works successfullty with v18.18.0 & v18.18.0

How often does it reproduce? Is there a required condition?

ive run the tests numerous times
the only condition I know is to run with v18.18.2

What is the expected behavior? Why is that the expected behavior?

  • should send a request topostman-echo.com but should override the Host to foo.postman-echo.com Header
  • the reason: this is how a http client should behave
  • see vor example: curl -H 'Host: foobar.com' https://postman-echo.com/get

What do you see instead?

  • the host header has not been overidden by the headers config
  • the initial set host in the request url is taken

Additional information

  • this was also tested in several docker images
    • node:18-alpine (contains bug)
    • node:18.18.2-alpine (contains bug)
    • node:18.18.2-alpine (no bug)
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    fetchIssues and PRs related to the Fetch APIIssues and PRs related to the Fetch API

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.