Skip to content

Commit

Permalink
Use changeOrigin for proxyRequest.
Browse files Browse the repository at this point in the history
  • Loading branch information
coderarity authored and indexzero committed Jul 22, 2012
1 parent 04ce49c commit 0273958
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/node-http-proxy/http-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0273958

Please sign in to comment.