diff --git a/lib/node-http-proxy/http-proxy.js b/lib/node-http-proxy/http-proxy.js index 50eb88a..890b6b0 100644 --- a/lib/node-http-proxy/http-proxy.js +++ b/lib/node-http-proxy/http-proxy.js @@ -237,7 +237,14 @@ 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; + outgoing.headers.host = this.target.host; + // Only add port information to the header if not default port + // for this protocol. + // See https://github.com/nodejitsu/node-http-proxy/issues/458 + if (this.target.port !== 443 && this.target.https || + this.target.port !== 80 && !this.target.https) { + outgoing.headers.host += ':' + this.target.port; + } } //