English
After local development and debugging, be sure to upload it to the uniCloud service space to take effect on the live network.
Distribution is divided into cloud resource distribution and client distribution.
Various cloud functions and DB Schemas need to be uploaded and released.
HBuilderX has a variety of distribution methods
Each applet platform requires the configuration of the network server domain name of the applet application in the applet management background, otherwise it will not be able to connect to the Internet.
After using uniCloud, developers no longer need to purchase and record domain names by themselves, and can directly fill in the uniCloud domain name in the applet management background. (If you need to use front-end web hosting, you still need to file a domain name)
According to the following table, set the request legal domain name and uploadFile legal domain name in the applet management background (if there is no file upload business, you can not set it). The domain names in the following table are all owned by Alibaba Cloud or Tencent Cloud, not DCloud.
服务提供商 | request合法域名 | uploadFile合法域名 | download合法域名 |
---|---|---|---|
阿里云 | api.next.bspapp.com | 请在uniCloud web控制台服务空间的总览页面查看 | 请在uniCloud web控制台服务空间的总览页面查看 |
腾讯云 | tcb-api.tencentcloudapi.com | 需要从云存储下载文件的时候才需要配置,不同服务空间域名不同,可以在web控制台查看文件详情里面看到 | |
支付宝小程序云 | {spaceId}.api-hz.cloudbasefunction.cn | https://u.object.cloudrun.cloudbaseapp.cn | {spaceId}.normal.cloudstatic.cn |
Notice
{spaceId}.api-hz.cloudbasefunction.cn
,其中{spaceId}
是服务空间的id,可以在uniCloud web控制台的服务空间总览页面查看Alibaba cloud view upload and download security domain name
For the real machine preview function of the applet development tool, the above-mentioned domain name whitelist must be added, otherwise the cloud function cannot be called. The PC-side preview and real-device debugging of the simulator are not affected by this.
If you encounter a valid domain name configured correctly but still report url not in domain list
, please try to delete the applet on the phone, clear the client cache where the applet is located, restart the corresponding applet development tool and try again
If you encounter invalid ip xxx, not in whitelist
, please check whether the domain name whitelist is enabled in the MiniApp management background. If it is not used, it can be closed. If you confirm that you need to use the ip whitelist, please refer to: Fixed IP
About the use of the cloud function local debugging service in the applet
When you use the run menu in HBuilderX to run to the applet, it will connect to the local debugging service. Even if you choose to connect to the cloud cloud function before running, the applet will send a request to the local debugging service to detect whether the cloud function is called locally or in the cloud.
**It is recommended to ignore domain name verification directly in development mode. **
即使在开发工具勾选了忽略域名校验,体验版与正式版不会忽略域名校验。如果要发布体验版
或正式版
,请务必在HBuilderX内使用发行菜单。uni-app项目发行与运行输出的目录不同,请注意不要选错了
请务必在HBuilderX内使用【发行】菜单打包小程序,【运行】菜单打包的代码只能用于本地调试,【发行】菜单打包的代码才能发布体验版和正式版。
如果域名白名单提示 127.0.0.1
这个ip没有加入白名单,那代表你点的就是【运行】菜单发布的体验版,请务必点【发行】发布小程序。uni-app项目发行与运行输出的目录不同,请注意不要选错了
The domain name of the cloud function is bspapp.com or tencentcloudapi.com. But the developer's web front-end must be deployed under other domain names (including unicloud's front-end web page hosting). Then the web front-end js accessing the cloud function involves cross-domain issues, which makes the front-end js unable to connect to the cloud function server.
At this time, you need to operate in the background of uniCloud to bind a secure domain name to the cloud function. If the js of the front-end web page under which domain name wants to access the cloud function, configure the domain name. If you use unicloud front-end web page hosting, no matter if you have your own test domain name or a developer’s domain name, as long as you want to access cloud functions, you must configure the domain name here.
注意跨域配置需要带上端口信息。例如:前端页面运行于:www.xxx.com:5001,跨域配置内配置:www.xxx.com不会对此页面生效,需要配置为:www.xxx.com:5001,端口部分也支持通配符
If you want to break through the cross-domain restrictions during runtime, there are the following solutions:
When running to the Web side, use the built-in browser of HBuilderX to ignore cross-domain issues.
If you want to use an external browser to run when running, the scheme is as follows:
2021年9月16日
之前阿里云跨域配置不对云存储及前端网页托管生效,表现为云存储中图片绘制到canvas会污染画布,前端网页托管的网页不可在iframe中使用。
2021年9月16日
之后阿里云跨域配置可以对前端网页托管生效,仅对前端网页托管的自定义域名生效,不对默认域名生效,如何绑定自定义域名请参考:前端网页托管绑定自定义域名,设置之后可能需要几分钟才会生效。如果你在之前已经设置了跨域域名和前端网页托管的自定义域名,需要重新设置一次跨域域名才能生效。
2022年12月2日
阿里云正式版跨域配置支持使用通配符,限制配置9个跨域域名。正式版默认允许localhost跨域
2023年2月3日
阿里云正式版跨域配置对云存储生效,如果此前已配置跨域配置下次进行修改时会同步设置到云存储。
注意
127.0.0.1:*
到跨域配置内{"cache-control": "no-cache","pragma": "no-cache"}
uniCloud supports front-end static web page hosting, click the release menu in HBuilderX, generate Web, and deploy the generated front-end files in the front-end web page hosting of uniCloud For details, refer to.
It should be noted that you still need to configure the binding security domain name in uniCloud web console (see the previous chapter), so that the js of the front-end web page can access the cloud function.
uniCloud integrates cloud-integrated upgrade detection and management-side version maintenance. See details
App, applet, web unified publishing page. See details
##cli release
During large-scale development, it is often necessary to issue through the command line for continuous integration.
HBuilderX provides cli, see details