mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
Merge pull request #332 from ramitos/patch-1
add "with custom server logic" to the "Proxying WebSockets" section of the readme
This commit is contained in:
commit
eee6babc98
28
README.md
28
README.md
@ -463,6 +463,34 @@ server.on('upgrade', function(req, socket, head) {
|
|||||||
server.listen(8080);
|
server.listen(8080);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### with custom server logic
|
||||||
|
|
||||||
|
``` js
|
||||||
|
var httpProxy = require('http-proxy')
|
||||||
|
|
||||||
|
var server = httpProxy.createServer(function (req, res, proxy) {
|
||||||
|
//
|
||||||
|
// Put your custom server logic here
|
||||||
|
//
|
||||||
|
proxy.proxyRequest(req, res, {
|
||||||
|
host: 'localhost',
|
||||||
|
port: 9000
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
server.on('upgrade', function(req, socket, head) {
|
||||||
|
//
|
||||||
|
// Put your custom server logic here
|
||||||
|
//
|
||||||
|
proxy.proxyWebSocketRequest(req, socket, head, {
|
||||||
|
host: 'localhost',
|
||||||
|
port: 9000
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
server.listen(8080);
|
||||||
|
```
|
||||||
|
|
||||||
### Configuring your Socket limits
|
### Configuring your Socket limits
|
||||||
|
|
||||||
By default, `node-http-proxy` will set a 100 socket limit for all `host:port` proxy targets. You can change this in two ways:
|
By default, `node-http-proxy` will set a 100 socket limit for all `host:port` proxy targets. You can change this in two ways:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user