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

To be congruent with other popular http clients the port should be stripped from the 'Host' field when the port is 80. #404

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/node-http-proxy/http-proxy.js
Expand Up @@ -237,7 +237,8 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
// don't revert this without documenting it!
//
if (this.changeOrigin) {
outgoing.headers.host = this.target.host + ':' + this.target.port;
var port = (this.target.port-80==0?"":":"+this.target.port);
Copy link
Contributor

Choose a reason for hiding this comment

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

Use this.target.port == 80 for type coercion

Copy link
Contributor

Choose a reason for hiding this comment

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

Use this.target.protocol to determine if it should be 443 or 80.

outgoing.headers.host = this.target.host + port;
}

//
Expand Down