diff --git a/lib/node-http-proxy/http-proxy.js b/lib/node-http-proxy/http-proxy.js index e6577cc..9a8c20b 100644 --- a/lib/node-http-proxy/http-proxy.js +++ b/lib/node-http-proxy/http-proxy.js @@ -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