tencentyun / cos-wx-sdk-v5

腾讯云 COS 小程序 SDK(XML API)
https://cloud.tencent.com/product/cos
MIT License
192 stars 481 forks source link

bucket配置了cname怎么设置Cos请求地址 #16

Closed lwpassvoice closed 6 years ago

lwpassvoice commented 6 years ago

image 如图配置了upload.xxx.com的cname为xxx.cossh.myqcloud.com 怎么设置请求upload.xxx.com

carsonxu commented 6 years ago

这里有文档:https://cloud.tencent.com/document/product/436/13396 你的截图不完成。另外这个最好提交工单问一下?

lwpassvoice commented 6 years ago

额我是这个意思,用这个sdk的话,上传会直接走https://XXX-XXX.cos.ap-shanghai.myqcloud.com,upload的安全域名里没这个,就会上传不上去 image

lwpassvoice commented 6 years ago

所以配了cname,但是sdk里没找到直接走cname配置的域名的地方。。。

carsonxu commented 6 years ago

需要在你小程序里配置 wx.request 和 wx.uploadFile 域名白名单 xxx-xxx.cos.ap-shanghai.myqcloud.com

lwpassvoice commented 6 years ago

。。。这样的话如果要改buket每次都要提审?

carsonxu commented 6 years ago

cname 的域名可以下载,但是 cname 的域名不知道是否可以上传。 如果不行,你可以用你的域名做代理转发,然后指定请求的域名前缀:

new COS({
    Domain: 'https://xxx.com/<Bucket>-<AppId>/<Region>',
    ...
})
lwpassvoice commented 6 years ago

这样又会有证书问题QAQ uploadFile:fail Error: Hostname/IP doesn't match certificate's altnames: "Host: xxx.club. is not in the cert's altnames: DNS:*.cossh.myqcloud.com"

carsonxu commented 6 years ago

这个是 cname 错误码?可以改成代理

lwpassvoice commented 6 years ago

哦,明白了,还要搞证书托管