EMAS Serverless supports CDN configuration. You can configure features such as cross-origin resource sharing, URL signing, hotlink protection, IP blacklists and whitelists, and User-Agent blacklists and whitelists. These features help you identify and filter visitors to restrict access to your CDN resources and improve security.
Procedure
Log on to the EMAS console, select Serverless, and click Enter.
In the navigation pane on the left, choose Cloud Storage.
Click the CDN Configuration tab.
Click Edit Configuration to configure Cross-origin validation, URL signing, Hotlink protection, IP blacklists and whitelists, or User-Agent blacklists and whitelists.
After you complete the configuration, click Save.
Configure cross-origin validation
To share or access resources across domains, you can specify cross-origin rules to validate requests.
Parameter |
Description |
Cross-origin rule |
|
Cross-origin validation |
Note
When cross-origin validation is enabled, if a domain name in the Response header value contains a hyphen (
|
Configure URL signing
URL signing adds authentication to specific URLs based on a signing method. You can configure validation for the encrypted string and timestamp in the signed URL. This protects your site's resources from being downloaded or used by unauthorized sites. URL signing provides higher security than hotlink protection and is suitable for files that require a high level of security.
For more information about how URL signing works, see the CDN documentation.
You can calculate the signature based on the authentication method. You can also directly obtain the signed URL using the ListFile management API or the file.info client SDK.
Parameter |
Description |
Authentication type |
Alibaba Cloud CDN provides three types of signing methods. You can select an authentication type based on the format of the encrypted URL to protect your origin resources. The URL signing types are:
Note
A URL signing error returns a 403 error code.
|
Key |
The key used for signature calculation. |
Validity period of signed URL |
The validity period of the signed URL configured for the CDN. Users can access the CDN within this period. After this period, the authentication fails.
Example: The signing server generates a signed URL at 15:00:00 on 2020-08-15 (UTC+8). The validity period of the signed URL on the CDN is 1800 seconds. The signed URL expires at 15:30:00 on 2020-08-15 (UTC+8). |
Configure hotlink protection
You can configure a Referer blacklist or whitelist based on the Referer header of an access request. This feature identifies and filters visitors to restrict access to your CDN resources and prevents other sites from hotlinking to your resources.
For more information, see Hotlink protection.
Parameter |
Description |
|
Referer type |
Note
Blacklists and whitelists are mutually exclusive. You can select only one type at a time. |
|
Rules |
Note
The total length of the hotlink protection rules cannot exceed 60 KB. |
|
Advanced configuration |
Allow access to the resource URL directly from the browser's address bar |
If you select this option, CDN POPs allow users to access the current resource if the Referer field in the request is empty or missing, such as for browser requests. This applies to both Referer blacklists and whitelists. |
Exact match |
Whitelist: Use exact match mode to control whether the domain names in the whitelist must be an exact match.
Blacklist: Use exact match mode to control whether the domain names in the blacklist must be an exact match.
|
|
Configure IP blacklists and whitelists
You can configure an IP blacklist or whitelist based on the source IP address of an access request. This feature identifies and filters visitors to restrict access to your CDN resources and helps prevent issues such as malicious IP address abuse and attacks.
For more information, see IP blacklists and whitelists.
Parameter |
Description |
List type |
The IP list types are:
|
Rules |
Enter an IP address block (for example, 192.168.0.0/24) or an IP address (for example, 192.168.0.1). Entries cannot be repeated. Both IPv6 and IPv4 addresses are supported. To configure multiple IP addresses, separate them with line breaks.
|
Configure User-Agent blacklists and whitelists
The User-Agent header identifies the client that sends an access request. If you want to specify which clients can access your resources, you can configure a User-Agent blacklist or whitelist. This feature identifies and filters visitors to ensure that only allowed clients can access your resources.
For more information, see User-Agent blacklists and whitelists.
Parameter |
Description |
List type |
The User-Agent list types are:
|
Rules |
When you configure the User-Agent field, use a vertical bar (|) to separate multiple values. Wildcard characters (*) are supported. For example:
Note
|