changeOrigin option: set the host header to the proxy destination

This commit is contained in:
Dominic Tarr 2011-11-15 07:41:00 +11:00
parent b4d41c3628
commit f27d26f451

View File

@ -194,7 +194,9 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
outgoing.method = req.method;
outgoing.path = req.url;
outgoing.headers = req.headers;
outgoing.headers.host = this.target.host + (this.target.port == 80 ? '' : ':' + this.target.port)
if(this.changeOrigin)
outgoing.headers.host = this.target.host + (this.target.port == 80 ? '' : ':' + this.target.port)
//
// Open new HTTP request to internal resource with will act
// as a reverse proxy pass