I'm trying to check the SSL status of an external domain with node. It works fine with a test using google.com
. However, when I try a url which I know has an invalid SSL certificate (revoked in this case) the value for res.socket.authorized
is still true
Am I using this wrong or is there a better way to validate the status of a domain's SSL certificate?
const https = require('https');
const options = {
host: 'revoked.badssl.com',
method: 'get',
path: '/'
};
const req = https.request(options, res => {
console.log('Certificate Status: ', res.socket.authorized);
});
req.on('error', error => {
console.error('Error: ', error);
});
req.end();