Skip to content

If user set a customized header host field, the host should not be changed while sending request. #10805

@jasonsaayman

Description

@jasonsaayman

If user set a customized header host field, the host should not be changed while sending request.

However, when using proxy config and default adapter http in nodejs, the host header will be reset to request url no matter config headers.host field is set or not.

example:

axios.get("http://127.0.0.1:4000", {
  headers: {
    host: "example.com",
  },
  proxy: {
    protocol: "http",
    host: "127.0.0.1",
    port: 8888,
  },
});

proxy request should keep header host field as example.com instead of 127.0.0.1:4000

before:

GET / HTTP/1.1
host 127.0.0.1:4000

fix:

GET / HTTP/1.1
host example.com

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions