User-Agent のブラックリストまたはホワイトリストは、HTTP リクエストヘッダーの User-Agent フィールドに基づいて、アクセラレーションドメイン名配下のリソースへのアクセスを制御する機能です。ブラックリストを設定して特定のクライアントを拒否したり、ホワイトリストを設定して特定のクライアントのみを許可したりできます。
Blacklist and whitelist types
A User-Agent list has the following types:
Blacklist — If the User-Agent field of an HTTP request header matches the blacklist, the user cannot access the requested resource, and a 403 status code is returned.
Whitelist — Users can access the resources under the accelerated domain name only if the User-Agent field of the HTTP request header matches the whitelist.
Select the type based on the access control result that you want:
To block specific clients, such as IE browsers, and allow all other clients, select Blacklist.
To allow only specific clients and block all other clients, select Whitelist.
Usage notes
Before you configure a User-Agent blacklist or whitelist, note the following:
The User-Agent blacklists and whitelists feature does not support access control for requests that do not carry a User-Agent header. To control these requests, use the EdgeScript feature instead. For more information, see EdgeScript. Alternatively, submit a ticketapply for backend configuration.
To perform access control on requests that carry a User-Agent header with an empty value, use
^$to represent an empty User-Agent value. The^$pattern matches only an empty User-Agent value, not requests that do not carry a User-Agent header.Under a whitelist: If a rule contains
^$, requests that carry a User-Agent header with an empty value are allowed.Under a blacklist: If a rule contains
^$, requests that carry a User-Agent header with an empty value are denied.
When this feature references rule conditions from the Rules Engine, the execution order follows the priority order of the rule conditions configured in the Rules Engine, not the priority order of this feature's own configuration.
Procedure
Log on to the DCDN console.
Log on to the DCDN console.
In the left-side navigation pane, click [ドメイン名].
ドメイン名 ページで、対象のドメイン名を見つけ、設定 をクリックします。
Click the [ユーザーエージェントブラックリスト/ホワイトリスト] tab.
Turn on the [ユーザーエージェントブラックリスト/ホワイトリスト] switch. Follow the on-screen instructions to configure the User-Agent [ブラックリスト] or [ホワイトリスト].
Parameter
Description
[タイプ]
The type of the User-Agent list. Valid values: Blacklist and Whitelist. For the behavior of each type, see Blacklist and whitelist types.
[ルール]
When you configure User-Agent fields, separate multiple values with vertical bars (|). Wildcards (*) are supported. Example:
*curl*|*IE*|*chrome*|*firefox*.説明For more information about how to match an empty User-Agent value and requests that do not carry a User-Agent header, see Usage notes.
Click [OK].
Examples
Example 1: Blacklist
Rule:
*IE*|^$
Result: When a request comes from an IE browser, or the User-Agent field of the request header carries an empty value, the requested resource cannot be accessed. Requests that do not carry a User-Agent header are not affected by this rule.
Example 2: Whitelist
Rule:
*IE*|*firefox*
Result: Only requests from IE or Firefox browsers can access the requested resource. All other requests are denied.