最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Is it possible to ignore ssl verification for fetch api in react app? - Stack Overflow

programmeradmin2浏览0评论

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?

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?

Share Improve this question edited Mar 30, 2018 at 2:24 t.niese 40.9k9 gold badges77 silver badges107 bronze badges asked Mar 30, 2018 at 1:50 JakimJakim 1,8139 gold badges26 silver badges47 bronze badges 3
  • In a test environment, or for any arbitrary browser visiting your site? – t.niese Commented Mar 30, 2018 at 2:14
  • 1 @t.niese, in a test environment. – Jakim Commented Mar 30, 2018 at 11:33
  • 1 If it is in an test eniroment, then you cann add this certificat to you browse, and then your browser won't plain about it anymore. – t.niese Commented Mar 30, 2018 at 12:13
Add a ment  | 

2 Answers 2

Reset to default 4

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.

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./bitinn/node-fetch/issues/19#issuement-289709519

发布评论

评论列表(0)

  1. 暂无评论