Jakim
Jakim

Reputation: 1813

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?

Upvotes: 15

Views: 34801

Answers (2)

Meghan
Meghan

Reputation: 1261

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.

Upvotes: 4

Martin Muzatko
Martin Muzatko

Reputation: 326

Alternatively, you can relay the request via your own server. but some instance needs to have SSL enabled, if the app itself runs on HTTPS.

on the server-side you can ignore wrong certificates. E.g.: https://github.com/bitinn/node-fetch/issues/19#issuecomment-289709519

Upvotes: -1

Related Questions