react-native axios https请求证书问题
_method: 'POST',_response: 'Unacceptable certificate: CN=DigiCert Global Root CA, OU=www.digicert.com, O=DigiCert Inc, C=US',
·
react-native使用axios请求后台服务,Android9报错如下
{ UNSENT: 0,
OPENED: 1,
HEADERS_RECEIVED: 2,
LOADING: 3,
DONE: 4,
readyState: 4,
status: 0,
timeout: 30000,
withCredentials: true,
upload: {},
_aborted: false,
_hasError: true,
_method: 'POST',
_response: 'java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.',
_url: 'xxxxxxxxxxxx',
_timedOut: false,
_trackingName: 'unknown',
_incrementalEvents: false,
responseHeaders: undefined,
_requestId: null,
_cachedResponse: undefined,
_headers: { 'content-type': 'application/x-www-form-urlencoded;charset=UTF-8' },
_responseType: '',
_sent: true,
_lowerCaseResponseHeaders: {},
_subscriptions: [] },
response: undefined,
isAxiosError: true,
toJSON: [Function: toJSON],
line: 120970,
column: 26,
sourceURL: 'http://172.31.52.97:8081/index.bundle?platform=android&dev=true&minify=false' }
Android10报错如下
_method: 'POST',
_response: 'Unacceptable certificate: CN=DigiCert Global Root CA, OU=www.digicert.com, O=DigiCert Inc, C=US',
证书本来是ca证书的,这个坑在于之前的同事在Android的AndroidManifest.xml文件中配置的android:networkSecurityConfig配置了这个域名的证书为自签名证书,如下
配置的说明参照谷歌的官方文档:https://developer.android.google.cn/training/articles/security-config#domain-config
更多推荐
已为社区贡献3条内容
所有评论(0)