|
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 |
| - }; |
| 1 | +var caronte = require('caronte'); |
| 2 | +/* |
| 3 | + * Create your proxy server pointing to a secure domain |
| 4 | + */ |
| 5 | +var options = {target:'https://google.com'}; |
11 | 6 |
|
12 | 7 | 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 | 8 | console.log("Proxy server listening on port 8000");
|
19 | 9 | proxyServer.listen(8000);
|
20 | 10 |
|
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 |
| - xfwd:true}; |
43 |
| - |
44 |
| -var proxyServer3 = caronte.createProxyServer(options3); |
45 |
| - |
46 |
| -proxyServer3.ee.on('*:error', function(err, req, res){ |
47 |
| - res.end('There was an error proxying your request'); |
48 |
| -}); |
49 |
| - |
50 |
| -console.log("Proxy server 3 listening on port 8002"); |
51 |
| -proxyServer3.listen(8002); |
52 |
| - |
53 |
| - |
54 |
| - |
55 |
| - |
0 commit comments