在对小程序进行开发的时候,对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 you@example.com

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,

})

}

})


展开全部
收起
0回答
提交回答
  • 至过去的我

    2044人对此回答表示赞同

    我是未来的你,你现在是不是在年找寻小程序答案。你不要感觉诧异,给你来信原因,就是让你不在后悔。今天去学习如何推广小程序,相信......点击查看更多>
    发布于
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
咨询热线

13312967497

扫码添加业务即可随时咨询 还可领取小程序推广攻略

业务咨询: 13312967497
扫码咨询

扫码咨询套餐

回到顶部