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

Host header includes port when making 80 request #246

Closed
gajus opened this issue Feb 27, 2017 · 3 comments
Closed

Host header includes port when making 80 request #246

gajus opened this issue Feb 27, 2017 · 3 comments

Comments

@gajus
Copy link
Contributor

gajus commented Feb 27, 2017

Some servers will fail if the request Host header includes the port number when making a request on port :80. Now node-fetch (or rather the underlying Node.js module) includes Host header that includes the port.

I have fixed this using a wrapper.

gajus/xfetch@3e8a797

@TimothyGu
Copy link
Collaborator

I don't see this happening:

> fetch('https://httpbin.org/headers').then(r => r.json()).then(j => console.log(j.headers.Host))
Promise { <pending> }
> httpbin.org

Can you give a more specific method for reproduction?

@gajus
Copy link
Contributor Author

gajus commented Feb 27, 2017

You will need to intercept the request, e.g. using mitmproxy.

screen shot 2017-02-27 at 17 33 49

@gajus
Copy link
Contributor Author

gajus commented Feb 27, 2017

Right. Now I understand why I felt deja vu while working on this.

I have already raised an issue about this in the past with https-proxy-agent.

TooTallNate/proxy-agents#22

Sorry, not related to node-fetch.

@gajus gajus closed this as completed Feb 27, 2017
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

No branches or pull requests

2 participants