Skip to content

Commit 3130665

Browse files
committed
[fix] Emit notFound event when ProxyTable location does not exist. Fixes #355. Fixes #333.
1 parent 4c1a2c1 commit 3130665

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,10 @@ RoutingProxy.prototype.proxyRequest = function (req, res, options) {
195195
//
196196
if (!location) {
197197
try {
198-
res.writeHead(404);
199-
res.end();
198+
if (!this.emit('notFound', req, res)) {
199+
res.writeHead(404);
200+
res.end();
201+
}
200202
}
201203
catch (er) {
202204
console.error("res.writeHead/res.end error: %s", er.message);

0 commit comments

Comments
 (0)