Skip to content

Commit

Permalink
Update the README to describe middleware err handler.
Browse files Browse the repository at this point in the history
  • Loading branch information
philjackson authored and indexzero committed Dec 27, 2013
1 parent bc12ca3 commit 25bb3bf
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Expand Up @@ -441,6 +441,17 @@ A regular request we receive is to support the modification of html/xml content

[Harmon](https://github.com/No9/harmon/) is a stream based middleware plugin that is designed to solve that problem in the most effective way possible.

If you would like to handle errors passed to `next()` then attach a listener to the proxy:

server = httpProxy.createServer(
myMiddleWare,
9000, 'localhost'
).listen(8000);

server.proxy.on('middlewareError', function (err, res, req) {
// handle the error here and call res.end()
});

## Proxying WebSockets
Websockets are handled automatically when using `httpProxy.createServer()`, however, if you supply a callback inside the createServer call, you will need to handle the 'upgrade' proxy event yourself. Here's how:

Expand Down

0 comments on commit 25bb3bf

Please sign in to comment.