diff --git a/lib/node-http-proxy/routing-proxy.js b/lib/node-http-proxy/routing-proxy.js index 3216c82..b9b8a17 100644 --- a/lib/node-http-proxy/routing-proxy.js +++ b/lib/node-http-proxy/routing-proxy.js @@ -195,8 +195,10 @@ RoutingProxy.prototype.proxyRequest = function (req, res, options) { // if (!location) { try { - res.writeHead(404); - res.end(); + if (!this.emit('notFound', req, res)) { + res.writeHead(404); + res.end(); + } } catch (er) { console.error("res.writeHead/res.end error: %s", er.message);