I am using fetch API in react single page application, and I need to access a self-signed https microservice, it fails because of the SSL verification. Is it possible to ignore the verification? And how to do it?
If you'd like to turn off curl's verification of the certificate, use the -k (or --insecure) option.
NODE_TLS_REJECT_UNAUTHORIZED = '0'; BUT THATS A VERY BAD IDEA since it disables SSL across the whole node server.. or you can configure axios to use a custom agent and set rejectUnauthorized to false for that agent as mentioned here example: // At instance level const instance = axios. create({ httpsAgent: new https.
Generate SSL CertificateNavigate to the root folder of your React app and generate an SSL certificate. First, create a folder for the certificate. Run the following to generate the certificate and store it in the folder you just created.
No, this error is from your browser and cannot be avoided in JavaScript. You must either add the self-signed certificate to your root certificate repository on your local machine or obtain a valid signed certificate from a free service such as Let's Encrypt.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With