|
| 1 | +var http = require('http') |
| 2 | + , https = require('https') |
| 3 | + , caronte = require('caronte') |
| 4 | + ; |
| 5 | +// |
| 6 | +// Create your proxy server |
| 7 | +// |
| 8 | +var options = {target:'https://google.com', |
| 9 | + agent: new https.Agent({rejectUnauthorized:false}), |
| 10 | + }; |
| 11 | + |
| 12 | +var proxyServer = caronte.createProxyServer(options); |
| 13 | + |
| 14 | +proxyServer.ee.on('*:error', function(err, req, res){ |
| 15 | + res.end('There was an error proxying your request'); |
| 16 | +}); |
| 17 | + |
| 18 | +console.log("Proxy server listening on port 8000"); |
| 19 | +proxyServer.listen(8000); |
| 20 | + |
| 21 | + |
| 22 | +// |
| 23 | +// Create your proxy server |
| 24 | +// |
| 25 | +var options2 = {target:'https://google.com', |
| 26 | + headers: {'host':'google.com'}, |
| 27 | + }; |
| 28 | + |
| 29 | +var proxyServer2 = caronte.createProxyServer(options2); |
| 30 | + |
| 31 | +proxyServer2.ee.on('*:error', function(err, req, res){ |
| 32 | + res.end('There was an error proxying your request'); |
| 33 | +}); |
| 34 | + |
| 35 | +console.log("Proxy server 2 listening on port 8001"); |
| 36 | +proxyServer2.listen(8001); |
| 37 | + |
| 38 | +// |
| 39 | +// Create your proxy server |
| 40 | +// |
| 41 | +var options3 = {target:'https://google.com'}; |
| 42 | + |
| 43 | +var proxyServer3 = caronte.createProxyServer(options3); |
| 44 | + |
| 45 | +proxyServer3.ee.on('*:error', function(err, req, res){ |
| 46 | + res.end('There was an error proxying your request'); |
| 47 | +}); |
| 48 | + |
| 49 | +console.log("Proxy server 3 listening on port 8002"); |
| 50 | +proxyServer3.listen(8002); |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
0 commit comments