Skip to content

Instantly share code, notes, and snippets.

@progre
Created October 2, 2014 13:10
Show Gist options
  • Save progre/854a9f60dd8a40692d8b to your computer and use it in GitHub Desktop.
Save progre/854a9f60dd8a40692d8b to your computer and use it in GitHub Desktop.
httpsにhttpproxyでつなぎに行く
var https = require('https');
var tunnel = require('tunnel');
var tunnelAg = tunnel.httpsOverHttp({
proxy: {
host: 'localhost',
port: 8080
}
});
var options = {
host: 'www.google.co.jp',
port: 443,
auth: "username:password",
path: '/',
agent: tunnelAg
};
https.get(options, function (res) {
res.on('data', function (chunk) {
console.log(chunk.toString());
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment