Created
April 22, 2020 16:58
-
-
Save stevesloka/360e654f232f6999dde4d07963c74c86 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var tls=require("tls") | |
var https=require("https") | |
var options={ | |
host:"containersteve.com", | |
// host:"demo.projectcontour.io", | |
port:443, | |
path:"/" | |
} | |
var agentOptions = { | |
rejectUnauthorized: true //this option disables certificate verification when it is false, you may need to disable it to connect to a server without having SNI enabled | |
} | |
var agent = new https.Agent(agentOptions) | |
agent.createConnection=function(options,callback){ | |
options.servername=undefined //setting servername to undefined disables SNI | |
return socket=tls.connect(options,callback) | |
} | |
options.agent=agent | |
request=https.request(options,function(response){ | |
console.log(response.statusCode) | |
response.on("data",function(data){ | |
console.log(data.toString()) | |
}) | |
}) | |
request.end() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment