-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH: added new https example, needs to be simplified before merge
updated existing example with log output
- Loading branch information
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
var http = require('http') | ||
, https = require('https') | ||
, caronte = require('caronte') | ||
; | ||
// | ||
// Create your proxy server | ||
// | ||
var options = {target:'https://google.com', | ||
agent: new https.Agent({rejectUnauthorized:false}), | ||
}; | ||
|
||
var proxyServer = caronte.createProxyServer(options); | ||
|
||
proxyServer.ee.on('*:error', function(err, req, res){ | ||
res.end('There was an error proxying your request'); | ||
}); | ||
|
||
console.log("Proxy server listening on port 8000"); | ||
proxyServer.listen(8000); | ||
|
||
|
||
// | ||
// Create your proxy server | ||
// | ||
var options2 = {target:'https://google.com', | ||
headers: {'host':'google.com'}, | ||
}; | ||
|
||
var proxyServer2 = caronte.createProxyServer(options2); | ||
|
||
proxyServer2.ee.on('*:error', function(err, req, res){ | ||
res.end('There was an error proxying your request'); | ||
}); | ||
|
||
console.log("Proxy server 2 listening on port 8001"); | ||
proxyServer2.listen(8001); | ||
|
||
// | ||
// Create your proxy server | ||
// | ||
var options3 = {target:'https://google.com'}; | ||
|
||
var proxyServer3 = caronte.createProxyServer(options3); | ||
|
||
proxyServer3.ee.on('*:error', function(err, req, res){ | ||
res.end('There was an error proxying your request'); | ||
}); | ||
|
||
console.log("Proxy server 3 listening on port 8002"); | ||
proxyServer3.listen(8002); | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters