Issue
After you set hotlink protection, access the Alibaba Cloud Content Delivery Network acceleration resource and return a 403 error.
Cause
The hotlink protection setting is abnormal or empty.
Solution
Use the following operations to confirm the specific cause of the 403 error returned by the access Alibaba Cloud Content Delivery Network acceleration resource, and handle the error according to different causes.
Troubleshoot the cause of the problem
- Run the curl command to test the access to the Alibaba Cloud Content Delivery Network accelerated domain name.
curl -voa -e "http://demo.aliyundoc.com" http://example.aliyundoc.com
The system display is similar to the following. The HTTP headband of the Request request has a domain name with Referer asdemo.aliyundoc.com
. A 403 error occurs. At the same time, the specific error message is "denied by Referer ACL", indicating that the hotlink protection setting is abnormal. - Run the curl command to test the access to the Alibaba Cloud Content Delivery Network accelerated domain name.
curl -voa http://example.aliyundoc.com
The system display is similar to the following. The HTTP header of the Request request does not have Referer information, and a 403 error occurs. At the same time, the specific error message is "denied by Referer ACL", indicating that the hotlink protection is set to empty. - Open a URL link for Alibaba Cloud Content Delivery Network acceleration through Chrome browser, and open the developer tool. The display is similar to the following. The HTTP header of the Request request does not have Referer information, indicating that the hotlink protection is set to empty.
Solution for setting hotlink protection to an exception
Determines whether the domain name with the Referer demo.aliyundoc.com
matches the hotlink protection set for the accelerated domain name example.aliyundoc.com
. Log on to the Alibaba Cloud Content Delivery Network console, click Manage on the right side of the corresponding accelerated domain name, choose RAM > Refer hotlink protection > Modify Configuration, and select Whitelist. If you confirm that the hotlink protection settings do not match the request Referer, add the demo.aliyundoc.com
domain name.
Solution to setting hotlink protection to empty
Log on to the Alibaba Cloud Content Delivery Network console, click the corresponding accelerated domain name management, choose RAM > Refer hotlink protection > Modify configuration, select whitelist, and select Allow direct access to resource URLs through the browser address bar.
Note: If you do not allow empty Referer access to hotlink protection, the risk may be that the hotlink is stolen.
Applicable scope
- CDN