After you add a domain name to Alibaba Cloud CDN, we recommend that you test whether the domain name is accessible before you update the CNAME record of the domain name. This ensures that DNS updates do not affect the services of the domain name. This topic describes how to use an on-premises machine to test whether a domain name is accessible before it is mapped to the CNAME assigned by Alibaba Cloud CDN.

Note During the test, requests are sent to CDN POPs. You are charged for the basic services and value-added services of Alibaba Cloud CDN that you have used. The billing rules of Alibaba Cloud CDN apply in the test. For more information, see Billable items.

Prerequisites

  • A domain name is added to Alibaba Cloud CDN. If you have not added a domain name to Alibaba Cloud CDN, add one to Alibaba Cloud CDN. For more information, see Add a domain name.
  • The origin server that you configure can be accessed.

Procedure

  1. Log on to the Alibaba Cloud CDN console, navigate to the Domain Names page, and then copy the CNAME of the domain name.
    Domain Names
  2. Obtain the IP address of the CNAME.
    Note The following IP address is an example returned by running the ping command and is for reference only. To obtain the actual IP address of your CNAME, run the ping command to ping your CNAME.
    • Windows: To obtain the IP address of your CNAME, open the command-line interface and run the ping CNAME command.
    • macOS: To obtain the IP address of your CNAME, open the command-line interface and run the dig CNAME command.MAc dig CNAME
  3. Add the IP address and domain name to the hosts file of the on-premises machine.

    You must add the IP address obtained from Step 2 and the domain name to the hosts file of the on-premises machine. Make sure that you add the IP address before the domain name.

    In this example, the domain name is example.com, the CNAME is example.com.w.kunlunsl.com, and the IP address of the CNAME is 192.168.0.1.

    • The path of the hosts file in Windows is C:\Windows\System32\drivers\etc\hosts. The following figure is an example. Example
    • The path of the hosts file in macOS is Finder > Go > Go to the folder > /etc/hosts. The following figure is an example. hosts file
  4. Test whether the domain name is accessible.
    After you add the IP address and domain name to the hosts file, you can open the browser and enter the domain name in the address bar to test the connectivity. You can view the test result by using the developer tool of the browser.
    • If the IP address in the Remote Address field is the same as the one that you add to the hosts file, the configuration is valid. You can configure the CNAME on the DNS service provider side. Test the connectivity of the website
    • If the IP address in the Remote Address field is different from the one that you add to the hosts file, the configuration is invalid. Make sure that you add the IP address of the CNAME to the hosts file.

    After you access the domain name, you can also test other features by using the on-premises machine.

What to do next

Add a CNAME record for a domain name: After a domain name is added to Alibaba Cloud CDN, Alibaba Cloud CDN assigns a CNAME to the domain name. You must add a CNAME record for the domain name before CDN acceleration can take effect.