Skip to content

Commit cee3e2f

Browse files
committed
Use changeOrigin for proxyRequest.
1 parent e4f1c79 commit cee3e2f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/node-http-proxy/http-proxy.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,14 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
216216
outgoing.path = req.url;
217217
outgoing.headers = req.headers;
218218

219+
//
220+
// If the changeOrigin option is specified, change the
221+
// origin of the host header to the target URL! Please
222+
// don't revert this without documenting it!
223+
//
224+
if(this.changeOrigin)
225+
outgoing.headers.host = this.target.host + ':' + this.target.port;
226+
219227
//
220228
// Open new HTTP request to internal resource with will act
221229
// as a reverse proxy pass

0 commit comments

Comments
 (0)