How can I verify SSL certificate on https of given domain by NodeJS?
I need to know if user open this like is it trusted or should add it as exception?
--
I think this code should raise error during unsigned or selfsigned certificate.
var https = require('https');var options = { host: 'daarkoob.ir', port: 2222, path: '/', method: 'GET', rejectUnauthorized:true};var req = https.request(options, function(res) { console.log("statusCode: ", res.statusCode); console.log("headers: ", res.headers);});req.end();req.on('error', function(e) { console.error(e);});
https://daarkoob.ir:2222 is self signed certificated,so above code should raise error during surfing.but nothing happened.