diff --git a/lib/http-proxy/index.js b/lib/http-proxy/index.js index 977a4b362..afc26feff 100644 --- a/lib/http-proxy/index.js +++ b/lib/http-proxy/index.js @@ -78,8 +78,13 @@ function createRightProxy(type) { * refer to the connection socket * pass(req, socket, options, head) */ - if(passes[i](req, res, requestOptions, head, this, cbl)) { // passes can return a truthy value to halt the loop - break; + try { + if(passes[i](req, res, requestOptions, head, this, cbl)) { // passes can return a truthy value to halt the loop + break; + } + } catch ( e ) { + this.emit('error', e); + continue; } } };