The User-Agent is part of the HTTP request header and identifies the client's operating system, browser type, and version. Use User-Agent blacklist/whitelist rules to control access to your resources and improve security.
Notes
You can configure either a User-Agent blacklist or a whitelist, but not both at the same time.
If a request's
User-Agentheader matches a value on the blacklist, the CDN point of presence (POP) denies the request, returns a403status code, and logs the request.Blocking a request still consumes CDN POP resources. Therefore, you may incur a small amount of fees for traffic and, if applicable, for HTTPS requests.
Procedure
Log on to the CDN console.
In the left navigation pane, click Domain Names.
On the Domain Names page, find the target domain name and click Manage in the Actions column.
In the domain's navigation pane, click Access Control.
Click the User-Agent Blacklist/Whitelist tab.
On the User-Agent Blacklist/Whitelist tab, click Modify.
Configure a Blacklist or Whitelist for the User-Agent header as prompted.
Parameter
Description
Type
The following are the User-Agent list types:
Blacklist
If the User-Agent field in an HTTP request header matches a value in the blacklist, the request is rejected and an HTTP 403 status code is returned.
Whitelist
Only requests whose User-Agent field in the HTTP request header matches a value in the whitelist are allowed to access resources on the accelerated domain name.
Rules
When you configure User-Agent fields, use vertical bars (|) to separate multiple values. The wildcard character (*) is supported. Example:
*curl*|*IE*|*chrome*|*firefox*.NoteTo control access for requests that contain an empty User-Agent header, use the
this-is-empty-uaparameter to represent an empty User-Agent value.Whitelist: If the rules contain
this-is-empty-ua, requests that contain an empty User-Agent header are allowed.Blacklist: If the rules contain
this-is-empty-ua, requests that contain an empty User-Agent header are rejected.
The User-Agent blacklist and whitelist feature does not support access control for requests that do not contain the User-Agent header. You can use the EdgeScript feature to implement this. For more information, see EdgeScript. Alternatively, or submit a ticket to request a backend configuration.
Rule Condition
Rule conditions identify various parameters in a user request to determine whether a configuration applies to the request.
Do not use: Do not use rule conditions.
To add or edit rule conditions, manage them in the Rules Engine.
Click OK.
Configuration examples
Example 1: Use whitelist to allow requests with from IE or Firefox
Rule:
*IE*|*firefox*Result: Only requests from Internet Explorer or Firefox are allowed to access the requested resources. All other requests are rejected.
Example 2: Use blacklist to block requests with an empty User-Agent header
Rule:
this-is-empty-uaResult: Requests with an empty User-Agent header are rejected.