Skip to content

Commit cce888a

Browse files
don't forward proxy- headers
1 parent 45c302b commit cce888a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/proxy.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,12 +659,19 @@ Proxy.prototype._onHttpServerRequest = function(isSSL, clientToProxyRequest, pro
659659
ctx.proxyToClientResponse.on('error', self._onError.bind(self, 'PROXY_TO_CLIENT_RESPONSE_ERROR', ctx));
660660
ctx.clientToProxyRequest.pause();
661661
var hostPort = Proxy.parseHostAndPort(ctx.clientToProxyRequest, ctx.isSSL ? 443 : 80);
662+
var headers = {};
663+
for (var h in ctx.clientToProxyRequest.headers) {
664+
// don't forward proxy- headers
665+
if (/^proxy\-/i.test(h)) {
666+
headers[h] = ctx.clientToProxyRequest.headers[h];
667+
}
668+
}
662669
ctx.proxyToServerRequestOptions = {
663670
method: ctx.clientToProxyRequest.method,
664671
path: ctx.clientToProxyRequest.url,
665672
host: hostPort.host,
666673
port: hostPort.port,
667-
headers: ctx.clientToProxyRequest.headers,
674+
headers: headers,
668675
agent: ctx.isSSL ? self.httpsAgent : self.httpAgent
669676
};
670677
return self._onRequest(ctx, function(err) {

0 commit comments

Comments
 (0)