Skip to content

Commit

Permalink
[fix] Emit notFound event when ProxyTable location does not exist. F…
Browse files Browse the repository at this point in the history
…ixes #355. Fixes #333.
  • Loading branch information
indexzero committed Mar 9, 2013
1 parent 4c1a2c1 commit 3130665
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/node-http-proxy/routing-proxy.js
Expand Up @@ -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);
Expand Down

1 comment on commit 3130665

@trusktr
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this work? How do we set up a condition when paths are not found?

Please sign in to comment.