Permalink
Browse files

[fix] Emit `notFound` event when ProxyTable location does not exist. …

…Fixes #355. Fixes #333.
  • Loading branch information...
1 parent 4c1a2c1 commit 3130665d9f1e05b87e2bcda972c971a45dbe94c1 @indexzero indexzero committed Mar 9, 2013
Showing with 4 additions and 2 deletions.
  1. +4 −2 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);

1 comment on commit 3130665

@trusktr

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

Please sign in to comment.