Skip to content

Commit b7adf86

Browse files
temsaindexzero
authored andcommitted
added what is necessary for having proxyError on Routing proxywq
1 parent ccccc45 commit b7adf86

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ RoutingProxy.prototype.add = function (options) {
9090
});
9191

9292
this.proxies[key] = new HttpProxy(options);
93+
this.proxies[key].on('proxyError', this.emit.bind(this, 'proxyError'));
94+
this.proxies[key].on('webSocketProxyError', this.emit.bind(this, 'webSocketProxyError'));
9395
};
9496

9597
//
@@ -183,6 +185,7 @@ RoutingProxy.prototype.proxyRequest = function (req, res, options) {
183185

184186
if (!this.proxies[key]) {
185187
this.add(options);
188+
186189
}
187190

188191
proxy = this.proxies[key];
@@ -220,7 +223,7 @@ RoutingProxy.prototype.proxyWebSocketRequest = function (req, socket, head, opti
220223

221224
if (!this.proxies[key]) {
222225
this.add(options);
223-
}
226+
}
224227

225228
proxy = this.proxies[key];
226229
proxy.proxyWebSocketRequest(req, socket, head, options.buffer);
@@ -244,4 +247,4 @@ RoutingProxy.prototype._getKey = function (options) {
244247
options.host || options.target.host,
245248
options.port || options.target.port
246249
].join(':');
247-
}
250+
}

0 commit comments

Comments
 (0)