我正在尝试使用axios在我的react应用程序中使用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;有没有办法禁用证书验证?
https://stackoverflow.com/questions/47630791
复制相似问题