This topic describes the typical scenarios for custom domain names and the procedure for binding a custom domain name to a web application.

Typical scenarios

Function Compute allows you to create HTTP functions. 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 URL <account_id>.<region>.fc.aliyuncs.com/<version>/proxy/<serviceName>/<functionName>/[action?queries] provided by Function Compute. However, you may need to change the URL of the web application later. To prevent the impact on user access to the web application, you can bind a custom domain name to the web application. The URL that users use to access the web application remains unchanged.

After you bind a custom domain name to a web application, you can also enable Alibaba Cloud 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 Alibaba Cloud CDN, see Alibaba Cloud CDN documentation.

Procedure

  1. Apply for an Internet Content Provider (ICP) filing for the custom domain name in 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.
  2. Configure your endpoint as the canonical domain name (CNAME) for your custom domain name.

    If you use Alibaba Cloud DNS, see the specific procedure in Quick Start.

    You must configure a CNAME for the custom domain name. A CNAME is in the format of <accountID>.<region>.fc.aliyuncs.com.

    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.

  3. Bind the custom domain name that has obtained an ICP filing to a web application in the Function Compute console. For more information, see Bind a custom domain name.
  4. Optional. Enable CDN acceleration for the custom domain name. For more information, see Enable CDN acceleration for Function Compute origins.