reactjs - https 在本机 axios 中未定义
问题描述
我已经使用 axios 来响应本机应用程序,但是在实现 https.agent 时它显示 https 是未定义的。如何解决这个问题?
我的代码
const instance = axios.create({
httpsAgent: new https.Agent({
rejectUnauthorized: false
})
});
instance.get('https://example.com');
// At request level
const agent = new https.Agent({
rejectUnauthorized: false
});
axios.post('/practz/login', {
"username" :"orgadmin1@example.com",
"password":"exam",
"appId":"AABBCD",
"domainName":"example.com",
httpsAgent: agent
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
解决方案
这是 Android 9 或 10 的问题,您必须在 Apache 配置中添加 SSLCertificateChainFile。
SSLCertificateChainFile "/opt/bitnami/apache2/conf/server-ca.crt"
然后它将正常工作
推荐阅读
- sql - 在 SSRS 中使用存储过程代替 SQL 查询时性能下降
- html - Django 模板继承不能正常工作
- kotlin - 从数组和对象中检索数据的任何功能性方法?
- weblogic12c - 将 OHS 11.1.1.9 连接到 FMW 12.2.1.4
- date - 获取产品在 Opencart 3 中的最后更新日期
- three.js - 使用非模块的 es6 类在 three.js 中合并指针锁定控制 API 很困难
- javascript - 如何翻转每个字符及其旁边的字符。Javascript
- javascript - 手动请求 javascript 的一项自动化
- objective-c - Objetive-C中如何setText自定义字体?
- reactjs - 达到极小的设备宽度时防止抽屉模态捕捉