Skip to content

Instantly share code, notes, and snippets.

@stevesloka
Created April 22, 2020 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevesloka/360e654f232f6999dde4d07963c74c86 to your computer and use it in GitHub Desktop.
Save stevesloka/360e654f232f6999dde4d07963c74c86 to your computer and use it in GitHub Desktop.
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