Access applications using a custom domain name

Updated at:

After you create a web application in the Serverless App Engine (SAE) console, SAE provides default public and internal network access addresses. While convenient for testing, these addresses are unsuitable for a production environment. This topic shows you how to use a custom domain name to access your web application.

How it works

image

Overview

To access a web application with a custom domain name, complete the following steps:

  1. Configure domain name resolution: Manually configure a CNAME record that points your custom domain name to the internal or public endpoint provided by SAE. This enables the DNS system to resolve your custom domain name and route traffic to your web application.

  2. Create a custom domain name: Ensure that the custom domain name has a valid ICP filing and is configured for DNS resolution. This domain serves as the entry point for your web application. You can enable the HTTPS protocol when creating the domain for secure data transmission.

  3. Bind the custom domain name to an application: Bind the custom domain name to your web application to allow access through the domain.

  4. Access the application: After completing the preceding steps, verify that you can access the target application by using the custom domain name.

Prerequisites

Step 1: Domain name resolution

This section provides an example of adding a public network CNAME record. You can add an internal network CNAME record in the same way.

Note

Configure a CNAME record for either the public or internal network, but not both.

  1. In the SAE console, find and copy the CNAME record for the target namespace.

    1. Go to the target namespace in the target region.

      In the left-side navigation pane, click Namespace. In the top navigation bar, select the target region. In the namespace list, click the target namespace.

    2. In the Create Custom Domain Name panel, copy the public CNAME.

      In the left-side navigation pane, click domain name management, and then click Create Custom Domain Name. In the panel that appears, find and copy the public CNAME.

      Note

      The CNAME is in one of the following formats:

      • Internal network CNAME: <account_id>.<region_id>-internal.sae.aliyuncs.com.

      • Public network CNAME: <account_id>.<region_id>.sae.aliyuncs.com.

  2. In the Alibaba Cloud DNS console, add a CNAME record for your ICP-filed custom domain name. For more information, see CNAME record.

    In the Add Record panel, set Resolution Request Source to Default and TTL to 10 minutes, and then click Confirm.

    Note
    • If the custom domain name is a subdomain, the host record is the subdomain prefix.

    • For the record value, use the Public CNAME you copied from the SAE console in the previous step.

Step 2: Create a custom domain name

  1. Return to the SAE console and navigate to the Create Custom Domain Name panel. Enter the custom domain name that has a valid ICP filing and has its domain name resolution configured. You can configure other settings as needed.

    Note
    • You can bind the target web application when you create the custom domain name, or after you create it. This topic demonstrates the latter approach.

    • During creation, you can choose whether to use HTTPS. If you enable HTTPS, you must upload an Alibaba Cloud SSL certificate.

    • During creation, you can choose whether to enable Web Application Firewall (WAF). If you enable WAF, traffic to this domain is protected by WAF and charged on a pay-as-you-go basis. For more information about billing, see Pay-as-you-go billing.

    • If you attempt to create a custom domain name in the SAE console for a domain that has a valid ICP filing but lacks DNS resolution, an error will occur.

Step 3: Bind a custom domain name

From the application page

  1. Log on to the SAE console and select the target application in the target namespace.

    In the left-side navigation pane, click Web Applications. In the top menu bar, select the target region.

  2. From the Bind Custom Domain Name drop-down list, select the desired custom domain name.

    On the application details page, click basic information in the left-side navigation pane. In the Custom Domain Name area at the bottom of the page, click Bind Custom Domain Name.

    Note

    If you do not have a custom domain name, click Bind Custom Domain Name > Create Custom Domain Name to create one. For more information, see Create a custom domain name.

From the domain management page

  1. Log on to the SAE console and go to the target namespace.

    In the left-side navigation pane, click domain name management. In the top menu bar, select the target region.

  2. On the domain name management page, find the custom domain name that you created in Step 2, and click Edit.

  3. Bind an application to the custom domain name.

    From the Bound Applications drop-down list, select the target application, and then click OK.

    Note

    If you did not enable HTTPS and Web Application Firewall during creation, you can enable them when editing the custom domain name.

Step 4: Access the application

Open a browser and enter your custom domain name in the address bar.

If the page displays Congratulations! and the message "You successfully deployed an application to SAE", your application has been successfully deployed to SAE.