@@ -45,6 +45,24 @@ You can easily add a `pass` (stages) into both the pipelines (XXX: ADD API).
45
45
46
46
In addition, every stage emits a corresponding event so introspection during the process is always available.
47
47
48
+ #### Setup a basic stand-alone proxy server
49
+
50
+ var http = require('http'),
51
+ caronte = require('caronte');
52
+ //
53
+ // Create your proxy server
54
+ //
55
+ caronte.createProxyServer({target:'http://localhost:9000'}).listen(8000) ;
56
+
57
+ //
58
+ // Create your target server
59
+ //
60
+ http.createServer(function (req, res) {
61
+ res.writeHead(200, { 'Content-Type': 'text/plain' });
62
+ res.write('request successfully proxied!' + '\n' + JSON.stringify(req.headers, true, 2));
63
+ res.end();
64
+ }).listen(9000);
65
+
48
66
#### Setup a stand-alone proxy server with custom server logic
49
67
50
68
``` js
@@ -72,6 +90,17 @@ server.listen(5050);
72
90
* Commit to your local branch (which must be different from ` master ` )
73
91
* Submit your Pull Request (be sure to include tests and update documentation)
74
92
93
+ ### Options
94
+
95
+ ` caronte.createProxyServer ` supports the following options:
96
+
97
+ * ** target** : <url string to be parsed with the url module >
98
+ * ** forward** : <url string to be parsed with the url module >
99
+ * ** ssl** : object to be passed to https.createServer()
100
+ * ** ws** : true/false, if you want to proxy websockets
101
+ * ** xfwd** : true/false, adds x-forward headers
102
+ * ** maxSock** : maximum number of sockets
103
+
75
104
### Test
76
105
77
106
```
0 commit comments