Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to ignore ssl verification for fetch api in react app?

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?

like image 436
Jakim Avatar asked Mar 30 '18 01:03

Jakim


People also ask

How does curl ignore SSL verification?

If you'd like to turn off curl's verification of the certificate, use the -k (or --insecure) option.

How do I disable SSL in Axios react native?

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.

How do I add an SSL certificate to react app?

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.


1 Answers

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.

like image 199
Meghan Avatar answered Oct 11 '22 13:10

Meghan