Skip to content

Commit f27d26f

Browse files
committed
changeOrigin option: set the host header to the proxy destination
1 parent b4d41c3 commit f27d26f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: lib/node-http-proxy/http-proxy.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
194194
outgoing.method = req.method;
195195
outgoing.path = req.url;
196196
outgoing.headers = req.headers;
197-
outgoing.headers.host = this.target.host + (this.target.port == 80 ? '' : ':' + this.target.port)
197+
198+
if(this.changeOrigin)
199+
outgoing.headers.host = this.target.host + (this.target.port == 80 ? '' : ':' + this.target.port)
198200
//
199201
// Open new HTTP request to internal resource with will act
200202
// as a reverse proxy pass

0 commit comments

Comments
 (0)