CDN acceleration domain name binding Host to the source site test method

Introduction: Users encounter abnormal access after using Alibaba Cloud CDN. When troubleshooting, in order to confirm whether the problem is related to the origin site, it is usually necessary to bypass the CDN and directly visit the origin site to compare the access effects of CDN acceleration and non-acceleration. . One of the methods is to change the domain name resolution record, and another easier method is to directly bind the local host to the origin site for access. This article describes how to point the domain name to the origin site without modifying the domain name resolution.

【CDN- Bind Host to the origin site】Option One
You can point the domain name to the origin site by modifying the hosts file without modifying the domain name resolution. The specific method is as follows.
1. Edit the hosts file
Note: When the browser accesses the domain name, it will preferentially obtain the IP address corresponding to the domain name from the hosts file. If there is no corresponding entry in the hosts file, the IP address pointed to by domain name resolution will be obtained through the local DNS server.
•In Windows system, the file save path is as follows

•C : WindowsSystem32driversetchosts
•In Linux system, the file save path is as follows


•/ etc / hosts
2. At the end of the hosts file, add an entry. This article takes the following entry as an example, where 1.1.1.1 is the IP address of the origin site, and www.test.com is the domain name to be checked.

3. Use the following command to test the domain name and confirm that the returned IP address is 1.1.1.1.
ping www.test.com _
4. Confirm whether it takes effect
, clear the browser's cache, and restart the browser to visit the website. At this time, the data will be obtained from the IP address 1.1.1.1 without using the CDN acceleration function. Open the browser developer mode, switch to the Network tab, and under General, you can see that the actually accessed Remote Address is 1.1.1.1.
Note: If the browser prompts an error, it means that there is a problem with the origin site.

【CDN- Bind Host to the origin site】Option II
Use the curl tool to initiate HTTP/HTTPS requests, and bind to the origin test by specifying parameters. Suppose 1.1.1.1 is the IP address of the origin site, and www.test.com is the domain name to be checked.
1. If there is no curl tool, please refer to the relevant documents to install the curl tool first.
2. For Windows , please open the command line window in the run bar cmd to run the curl command. For Mac/Linux, you can run it directly under the command line tool.
1. The origin site is port 80

curl- voa "http://www.test.com/" -x 1.1.1.1 : 80
2. The origin site is port 443

curl- voa " http://www.test.com/ " --resolve www.test.com:443:1.1.1.1
3. The origin site is a custom port
curl- voa "http://www.test.com/" -x 1.1.1.1 : custom port
Copyright statement: The content of this article is contributed by Alibaba Cloud's real-name registered users. The copyright belongs to the original author. The Alibaba Cloud developer community does not own the copyright and does not assume the corresponding legal responsibility. For specific rules, please refer to the " Alibaba Cloud Developer Community User Service Agreement " and " Alibaba Cloud Developer Community Intellectual Property Protection Guidelines ". If you find any content suspected of plagiarism in this community, fill out the infringement complaint form to report it. Once verified, this community will delete the allegedly infringing content immediately.

Related Articles

Explore More Special Offers

  1. Short Message Service(SMS) & Mail Service

    50,000 email package starts as low as USD 1.99, 120 short messages start at only USD 1.00