部分安卓报request:fail ssl hand shake error 。
发布于 5 年前 作者 ping31 12214 次浏览 来自 问答

在对小程序进行开发的时候,对request api 进行测试,

通过二维码预览的形式,部分安卓手机出现 request:fail ssl hand shake error 错误(Oppo A31u,红米2)。而小米max1和苹果手机可以正确显示,开发工具正常显示。

环境:

腾讯云,证书从腾讯云申请。

请各位前辈给点提示,怎么配置才是正确的。

部分httpd-ssl.conf配置内容

#   General setup for the virtual host

DocumentRoot “/opt/lampp/htdocs”

ServerName www.example.com:443

ServerAdmin [email protected]

ErrorLog “/opt/lampp/logs/error_log”

TransferLog "/opt/lampp/logs/access_log“

SSLEngine on

__SSLProtocol -all +TLSv1 +TLSv1.1 +TLSv1.2
__

 

SSLCertificateFile “/opt/lampp/etc/ssl/2_peipeixiu.cn.crt”

SSLCertificateKeyFile “/opt/lampp/etc/ssl/3_peipeixiu.cn.key”

SSLCertificateChainFile “/opt/lampp/etc/ssl/1_root_bundle.crt”

代码如下:

wx.request({

url: https://peipeixiu.cn, //仅为示例,并非真实的接口地址

data: {

x: ‘’,

y: ‘’

},

method: ‘GET’,

header: {

‘content-type’: ‘application/json’ // 默认值

},

success: function (res) {

console.log(res.data)

wx.showModal({

title: ‘Message’,

content: res.data,

})

},

fail:function(error){

wx.showModal({

title: ‘Error’,

content: error.errMsg,

})

}

})

回到顶部