微信小程序-百度小程序-QQ小程序-字节跳动小程序(今日头条)-Referer防盗链解决办法
小程序 Referer 防盗链问题及解决办法
在开发微信小程序、百度小程序、QQ 小程序以及字节跳动小程序(今日头条)时,可能会遇到 Referer 防盗链的问题。以下将针对平台,给出相应的解决办法。
各平台基础 Referer 地址
| 平台 | Referer 地址 |
|---|---|
| 微信小程序 | https://servicewechat.com |
| 字节跳动小程序 | https://tmaservice.developer.toutiao.com |
| 百度小程序 | https://smartapp. |
| QQ 小程序 | https://appservice.qq.com |
各平台带参数的 Referer 地址
| 平台 | Referer 地址 |
|---|---|
| 微信小程序 | https://servicewechat.com/{appid}/1/-frame.html |
| 字节跳动小程序 | https://tmaservice.developer.toutiao.com/?appid={appid}&version=1.1.1 |
| 百度小程序 | https://smartapp.baidu.com/{appKey}/0/page-frame.html |
| QQ 小程序 | ://.qq.com/QPageFrame.html_(null)_5 |
通用解决办法
白名单设置
将上述对应的请求地址加入白名单,即可解决大部分 Referer 防盗链问题。
备用方案
如果上述方法都无法解决问题,可以使用以下备用链接:
微信平台
servicewechat.com
百度平台
smartapps.*.apps
bcebos.com
支付宝平台
*.alipay-eco.com
*.alipay.com
通过以上方法,可以有效地解决小程序开发过程中遇到的 Referer 防盗链问题,确保小程序的正常运行。
正文完