Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

add "with custom server logic" to the "Proxying WebSockets" section of the readme #332

Merged
merged 1 commit into from

2 participants

@ramitos

No description provided.

@indexzero indexzero merged commit eee6bab into nodejitsu:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 8, 2012
  1. @ramitos
This page is out of date. Refresh to see the latest.
Showing with 28 additions and 0 deletions.
  1. +28 −0 README.md
View
28 README.md
@@ -444,6 +444,34 @@ server.on('upgrade', function(req, socket, head) {
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
By default, `node-http-proxy` will set a 100 socket limit for all `host:port` proxy targets. You can change this in two ways:
Something went wrong with that request. Please try again.