I am trying out a NodeJS sample file from a tutorial as I am new to NodeJS but I just can't make it work. I get an error when I run below code:
var https = require("https");
var fs = require("fs");
var options = {
hostname: "en.wikipedia.org",
port: 443,
path: "/wiki/George_Washington",
method: "GET",
}
var req = https.request(options, function(res){ });
req.on('error', function(e) {
console.log(`here comes the error ${e}`);
});
I get the following error:
here comes the error:
Error:101057795:error:140770FC:SSLroutines:SSL23_GET_SERVunknownprotocol:openssl\ssl\s23_clnt.c:794:
I am clueless, I appreciate your help and insight :)
Update: Code had to be modified to go through a proxy server. I posted the solution and findings.
curlthe request, and see what headers are being sentreq.end()since you're usinghttps.request()instead ofhttps.get().