mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
add "with custom server logic" to the "Proxying WebSockets" section of the readme.md
This commit is contained in:
parent
8a88774ecf
commit
03dbe115c2
28
README.md
28
README.md
@ -444,6 +444,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