The User-Agent HTTP header identifies the client that makes a request, including the operating system, OS version, browser, and browser version. You can configure a User-Agent blacklist or whitelist to filter requests by client identity and control access to ApsaraVideo VOD resources.
Usage notes
-
Whitelist: Only requests with a
User-Agentheader that matches a rule in the whitelist can access your resources. -
Blacklist: Requests with a
User-Agentheader that matches a rule in the blacklist are blocked.
A blocked request can still reach a POP, but the POP denies it and returns an HTTP 403 status code. Denied requests are recorded in CDN logs. -
The blacklist and whitelist are mutually exclusive and cannot be configured at the same time.
Procedure
-
Log in to the ApsaraVideo VOD console.
In the left-side navigation pane, choose Configuration Management > CDN Configuration > Domain Names.
-
Find the domain name that you want to configure and click Configure in the Actions column.
-
In the left-side navigation pane for the selected domain name, click Resource Access Control.
-
Click the User-Agent Blacklist/Whitelist tab.
-
On the User-Agent Blacklist/Whitelist tab, click Modify.
-
Configure the User-Agent Blacklist or Whitelist as prompted.
Item
description
Type
The list type.
-
Blacklist
If a request's User-Agent header matches a blacklisted value, access is denied and a 403 status code is returned.
-
Whitelist
Only requests whose User-Agent header matches a whitelisted value can access domain resources.
Rules
Specify the User-Agent values. Separate multiple values with a vertical bar (|). You can use an asterisk (*) as a wildcard. Example:
*curl*|*IE*|*chrome*|*firefox*.Note-
To control access for requests with an empty User-Agent header, use
this-is-empty-uato represent an empty User-Agent value.-
On a whitelist: If a rule includes
this-is-empty-ua, requests with an empty User-Agent header are allowed. -
On a blacklist: If a rule includes
this-is-empty-ua, requests with an empty User-Agent header are denied.
-
-
The User-Agent blacklist and whitelist do not support access control on requests without a User-Agent header. You can use EdgeScript to enable this feature. For more information, see EdgeScript overview.
-
-
Click OK to complete the configuration.
Sample configurations
-
Example 1: Configure a whitelist
Rule:
*IE*|*firefox*Expected result: Only requests that are sent from IE or Firefox are allowed to access resources on POPs.
-
Example 2: Configure a blacklist
Rule:
*IE*|this-is-empty-uaExpected result: Requests that are sent from IE or contain an empty User-Agent header are rejected.