Skip to content

fix(proxy): ensure the host field is correct when using proxy#40797

Open
Archkon wants to merge 1 commit into
microsoft:mainfrom
Archkon:main
Open

fix(proxy): ensure the host field is correct when using proxy#40797
Archkon wants to merge 1 commit into
microsoft:mainfrom
Archkon:main

Conversation

@Archkon
Copy link
Copy Markdown

@Archkon Archkon commented May 12, 2026

The host field should be set according target url not the proxy url

refer to https://www.rfc-editor.org/rfc/rfc9112#section-3.2.2

@Archkon Archkon changed the title fix(proxy): ensure the host filed is correct when using proxy fix(proxy): ensure the host field is correct when using proxy May 12, 2026
@yury-s
Copy link
Copy Markdown
Member

yury-s commented May 12, 2026

Please start with opening an issue that describes the problem, so that we can evaluate it.

Copy link
Copy Markdown
Member

@yury-s yury-s left a comment

Choose a reason for hiding this comment

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

Looks good, but please add a test for this. See e.g. 'should use env proxy with connectOverCDP discovery request' in tests/library/chromium/connect-over-cdp.spec.ts.

Comment thread packages/utils/network.ts
options.path = url.toString();
const headers = options.headers || {};
if (!Object.keys(headers).some(header => header.toLowerCase() === 'host'))
headers.Host = url.host;
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.

Suggested change
headers.Host = url.host;
headers.host = url.host;

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.

2 participants