This topic describes the typical scenarios for custom domain names and the procedure for binding a custom domain name to a web application.
Function Compute allows you to create an HTTP function. Only HTTP functions can be triggered by HTTP requests. In this context, a function can be considered as a web application that can process HTTP requests and return the results to the caller. In the following sample scenarios, you must bind a custom domain name to a web application:
- You have created a web application and want users to access the web application by using a fixed domain name. In this scenario, you can bind a custom domain name to the web application, so that users can use the domain name to access the web application.
- You have created a web application and can access it by using the default address
<account_id>.<region>.fc.aliyuncs.com/<version>/proxy/<serviceName>/<functionName>/[action? queries]provided by Function Compute. However, you may need to change the address of the web application later. To avoid affecting user access to the application, you can bind a custom domain name to it in advance. The link with which users access the web application then remains unchanged even after the address is changed.
After you bind a custom domain name to a web application, you can also enable Alibaba Cloud CDN (CDN) acceleration for the domain name. CDN acceleration uses your application in Function Compute as the origin and publishes its source content to edge nodes, so that users can obtain the content they need. For more information about CDN, see the CDN documentation.
- Apply for an Internet Content Provider (ICP) license for the custom domain name by using the Alibaba Cloud ICP Filing system or add Alibaba Cloud as a service provider to the ICP filing information of the custom domain name. For more information, see ICP filing application overview.
- Ensure that your custom domain name resolves to your endpoint.
If you use Alibaba Cloud DNS, see the specific procedure in Quick Start.
To ensure that your custom domain name resolves to your endpoint, configure a canonical domain name (CNAME) for your custom domain name. A CNAME is in the format of <accountID>.<region>.fc.aliyuncs.com.
For example, assume that your custom domain name is api.app.com, your account ID is 12345, and the region is China (Shanghai). In this case, you must set the CNAME for api.app.com to 12345.cn-shanghai.fc.aliyuncs.com.
- In the Function Compute console, bind your custom domain name to a web application. For more information, see Bind a custom domain name.
- Optional. Enable CDN acceleration for the custom domain name. For more information, see Enable CDN acceleration for Function Compute origins.