Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add Host header when used with http_proxy #10080

Merged
merged 2 commits into from
Apr 27, 2023
Merged

Conversation

magicdawn
Copy link
Contributor

fix: add Host header when used with http_proxy

What kind of change does this PR introduce?
a bugfix

Did you add tests for your changes?

If relevant, did you update the documentation?

Summary

Does this PR introduce a breaking change?
no

Other information

manual http.get() differs from use a agent = HttpProxyAgent() (imported from http-proxy-agent package) instance, for Host header.

say proxy for https://httpbin.org/headers

  • use https.get('https://httpbin.org/headers', { agent: HttpProxyAgent('http://127.0.0.1:54321') }) will have Host: httpbin.org sent to 127.0.0.1:54321
  • https.get without Host set will use proxy's host 127.0.0.1:54321 which breaks my current proxy server.

I found some evidence indicates it's client's job to make it right.

If the URL contains a hostname, the Host header must contain the same name.

Host headers and proxies
Some browser versions send incorrect Host headers, especially when configured to use proxies. > For example, when configured to use a proxy, some older versions of Apple and PointCast clients mistakenly sent the name of the proxy instead of the ori- gin server in the Host header.


AND why https-proxy-agent but not http-proxy-agent?

@google-cla
Copy link

google-cla bot commented Apr 25, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@OrKoN
Copy link
Collaborator

OrKoN commented Apr 26, 2023

Hey thanks for the PR. Would you mind signing the CLA agreement?

AND why https-proxy-agent but not http-proxy-agent?

That is lost to history :)

@magicdawn
Copy link
Contributor Author

signed.

@OrKoN OrKoN merged commit edbfff7 into puppeteer:main Apr 27, 2023
This was referenced Apr 27, 2023
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.

None yet

2 participants