Skip to content

Commit 553e7fb

Browse files
committedNov 29, 2011
Modified the ad-hoc proxy lookup to use _getKey(), rather than the
error-prone in-line method. _getKey() will look for options.target as well as options.host:options.port, and so is useful for a segmented proxy server where the destination proxies are not constructed before first references.
1 parent 1e33434 commit 553e7fb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
 

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ RoutingProxy.prototype.proxyRequest = function (req, res, options) {
180180
options.host = location.host;
181181
}
182182

183-
var key = options.host + ':' + options.port,
184-
proxy;
183+
var key = this._getKey(options),
184+
proxy;
185185

186186
if (!this.proxies[key]) {
187187
this.add(options);
@@ -218,8 +218,8 @@ RoutingProxy.prototype.proxyWebSocketRequest = function (req, socket, head, opti
218218
options.host = location.host;
219219
}
220220

221-
var key = options.host + ':' + options.port,
222-
proxy;
221+
var key = this._getKey(options),
222+
proxy;
223223

224224
if (!this.proxies[key]) {
225225
this.add(options);

0 commit comments

Comments
 (0)
Please sign in to comment.