Skip to content

Commit 603106a

Browse files
committed
Re-added previous description
1 parent ee6bbe0 commit 603106a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

+19
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,25 @@ httpProxy.createServer(
413413
## Proxying WebSockets
414414
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:
415415

416+
```js
417+
418+
var options = {
419+
....
420+
};
421+
422+
var server = httpProxy.createServer(
423+
callback/middleware,
424+
options
425+
);
426+
427+
server.listen(port, function() { ... });
428+
server.on('upgrade', function(req, socket, head) {
429+
server.proxy.proxyWebSocketRequest(req, socket, head);
430+
});
431+
```
432+
433+
If you would rather not use createServer call, and create the server that proxies yourself, see below:
434+
416435
``` js
417436
var http = require('http'),
418437
httpProxy = require('http-proxy');

0 commit comments

Comments
 (0)