xxxxxxxxxx
// Bypass SSL/TLS certificate verification
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
// Make the fetch request
fetch('https://example.com/api/data')
.then(response => response.json())
.then(data => {
// Handle the response data
console.log(data);
})
.catch(error => {
// Handle any errors
console.error(error);
});
xxxxxxxxxx
There’s one of two things that have happened to get this error, as we covered,
either you self-signed your SSL certificate or your Certificate Authority (CA)
is no longer trusted by the browsers. As we have seen with WoSign, StartCom
and Symantec, having your CA distrusted is not unheard of.
Either way, unless you’re a large enterprise working alongside a CA to set up
a Private CA for your massive network, our advice is to purchase an SSL
certificate from a trusted authority.