Use changeOrigin for proxyRequest.

This commit is contained in:
Christian Howe 2012-04-13 18:53:36 -04:00 committed by indexzero
parent 04ce49c5b2
commit 0273958b0a

View File

@ -216,6 +216,14 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
outgoing.path = req.url;
outgoing.headers = req.headers;
//
// If the changeOrigin option is specified, change the
// origin of the host header to the target URL! Please
// don't revert this without documenting it!
//
if(this.changeOrigin)
outgoing.headers.host = this.target.host + ':' + this.target.port;
//
// Open new HTTP request to internal resource with will act
// as a reverse proxy pass