No fallback possibility when no hostname matches the routing table #358

Closed
openhoat opened this Issue Jan 2, 2013 · 1 comment

1 participant

@openhoat

routing-proxy.js sends a 404 (line 197) when request hostname does not match the table.
It would be useful to have an event ('proxyError' for example) to let the app manage a fallback (default hostname for example).

@openhoat openhoat closed this Jan 3, 2013
@openhoat

A solution is to add a function callback and manage error there :

    httpProxy.createServer({ router:proxyRouter }, function (req, res, proxy) {
      var location = proxy.proxyTable.getProxyLocation(req);
      if (location) {
        proxy.proxyRequest(req, res);
      } else {
        res.writeHead(404, { 'Content-Type':'text/plain' });
        res.end('Oops');
      }
    });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment