Skip to content

Commit

Permalink
Re-added previous description
Browse files Browse the repository at this point in the history
  • Loading branch information
itsjamie committed Feb 22, 2013
1 parent ee6bbe0 commit 603106a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,25 @@ httpProxy.createServer(
## 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:

```js

var options = {
....
};

var server = httpProxy.createServer(
callback/middleware,
options
);

server.listen(port, function() { ... });
server.on('upgrade', function(req, socket, head) {
server.proxy.proxyWebSocketRequest(req, socket, head);
});
```

If you would rather not use createServer call, and create the server that proxies yourself, see below:

``` js
var http = require('http'),
httpProxy = require('http-proxy');
Expand Down

0 comments on commit 603106a

Please sign in to comment.