All Products
Search
Document Center

:How to point a domain name to the origin of a Alibaba Cloud Content Delivery Network without modifying domain name resolution

更新時間:Jan 12, 2022

Disclaimer: This topic may contain information about third-party products. The information is for reference only. Alibaba Cloud does not make a guarantee, explicitly or implicitly, with respect to the performance and reliability of the third-party products, and potential impacts of operations on the products.

Description

After you configure Alibaba Cloud CDN acceleration, when the access acceleration resource is abnormal, in order to confirm whether the problem is related to the origin, you usually need to bypass CDN to directly access the origin, and compare the CDN acceleration and unaccelerated access effects. This topic describes how to direct a domain name to the origin without modifying the domain name resolution.

References

When access to Alibaba Cloud Content Delivery Network acceleration resources is abnormal, the test method by binding the origin server is as follows:

Method 1: Modify the Hosts file

You can modify the hosts file to direct the domain name to the origin without modifying the domain name resolution. The specific methods are as follows.

  1. Edit the hosts file.
    Note: When you access a domain name in a browser, the IP address of the domain name is obtained from the hosts file. If there is no corresponding entry in the hosts file, the IP address pointed to by domain name resolution is obtained through the local DNS server.
    • In Windows, the file is saved in the following path.
      C:\Windows\System32\drivers\etc\hosts
    • In the Linux, the file is saved as follows.
      /etc/hosts
  2. At the end of the hosts file, add an entry. This topic uses the following entry as an example. 192.168.0.1 is the IP address of the origin server and example.aliyundoc.com is the domain name to be checked.
    192.168.0.1 example.aliyundoc.com
  3. Run the following command to test the domain name and make sure that the returned IP address is 192.168.0.1:
    ping example.aliyundoc.com
  4. Clean up the browser's cache and reopen the browser to access the website. In this case, data will be obtained from 192.168.0.1 this IP address without using the Alibaba Cloud Content Delivery Network acceleration feature.
    Note: If an error occurs in the browser, the origin server has a problem.

Method 2: Use the CURL tool to request the origin server over HTTP/HTTPS

Use the CURL tool to initiate HTTP/HTTPS requests and bind the specified parameters to the origin server for testing. Assume that the 192.168.0.1 is the origin IP address and the example.aliyundoc.com is the domain name to be checked.

Note:

  • If you do not have the CURL tool, please refer to the relevant documentation to install the CURL tool first.
  • For Windows, open the command line window and run the curl command. Mac/Linux can be run directly under the command line tool.
  1. The origin server is port 80. Run the following command.
    curl -voa "http://example.aliyundoc.com/" -x 192.168.0.1:80
  2. The origin server is a 443 port. Run the following command.
    curl -voa "http://example.aliyundoc.com/" --resolve example.aliyundoc.com:443:192.168.0.1
  3. If the origin server is a custom port, run the following command.
    curl -voa "http://example.aliyundoc.com/" -x 192.168.0.1:[$Port]
    Note :[$Port] is a custom port.

References

If the access to the origin site is normal, but there is a problem with the opening of the Alibaba Cloud Content Delivery Network accelerated domain name, see The parameters cannot be loaded after the site is connected to the Alibaba Cloud Content Delivery Network. To determine whether the problem is caused by the URL parameter.

Applicable scope

  • CDN