You can configure a referer blacklist or whitelist to authenticate and filter visitors. This can restrict access to Dynamic Route for CDN (DCDN) resources and improve DCDN security. This topic describes how to configure the referer-based hotlink protection feature.
- Hotlink protection is implemented based on the HTTP referer mechanism. It uses the referer header field to trace request sources and filter requests.
- Hotlink protection provides a referer whitelist and a referer blacklist. After a user sends a request to a DCDN node, the node authenticates the user identity based on the referer whitelist or blacklist. If the request passes the authentication, the user is allowed to access the requested resources. If the request fails the authentication, the DCDN node returns a 403 HTTP status code to the user.
- Hotlink protection is optional. It is disabled by default.
- Blacklists and whitelists are mutually exclusive. The most recent configuration takes effect.
- When a domain name is added to the whitelist or blacklist for hotlink protection, an asterisk (*) is automatically prepended to the domain name as a wildcard. For example, if you enter a.com, the domain name that takes effect is *.a.com. Hotlink protection takes effect on all the subdomains of a.com.
- You can specify whether to allow requests that have an empty referer header to access DCDN resources. If you select Allow resource URL access from browsers, users can access DCDN resources by entering the URL in the address bar of a browser.
- Log on to the DCDN console.
- In the left-side navigation pane, click Domain Names.
- On the Domain Names page, find the domain name that you want to manage, and click Configure in the Actions column.
- In the left-side navigation pane on the details page of the specified domain name, click Access Control.
- On the Hotlink Protection tab, turn on the Hotlink Protection switch.
- Configure a Blacklist or a Whitelist as prompted.
Parameter Description TypeThe following hotlink protection types are supported:
Requests sent from domain names in the blacklist are blocked.
Only requests sent from domain names in the whitelist are allowed to access the current resources.
The blacklist and whitelist are mutually exclusive. The most recent configuration takes effect.
Rules Separate multiple domain names by pressing Enter. You can use asterisks (*) to specify wildcard referer header fields. For example, you can enter
- Click OK.