SSL证书 – 禁用axios中的validation并作出反应

我试图在使用axios的应用程序中使用API​​。 该API通过使用自签名证书的HTTPS进行工作。 到目前为止,连接时出现以下错误:

net::ERR_INSECURE_RESPONSE bundle.js:65253 HTTP Failure in Axios Error: Network Error at createError (bundle.js:2188) at XMLHttpRequest.handleError (bundle.js:1717) 

我尝试了以下,但没有成功:

 import axios from 'axios'; const https = require('https'); const agent = new https.Agent({ rejectUnauthorized: false, }); const client = axios.create({ //all axios can be used, shown in axios documentation baseURL: process.env.REACT_APP_API_URL, responseType: 'json', withCredentials: true, httpsAgent: agent }); export default client; 

有什么办法来禁用证书validation?