Content Acceleration,Dynamic Web Acceleration
Query Time anti-theft chain custom configuration item content
Single user trigger frequency: 300/5min
| Name | Description |
|---|---|
*domainString | Domain ID or domain Name. |
| Name | Description |
|---|---|
x-cnc-request-idString | Uniquely identified id for querying tasks per request (for all API) |
| Name | Description |
|---|---|
domain-idString | Accelerated domain name ID |
domain-nameString | Name of accelerated domain name |
timestamp-visit-control-ruleObject | Timestamp-based Hotlink Protection Configuration
Important Notes:
1. Composition & Workflow: The protection consists of two sequential validations:
Hotlink Validation
Time Validity Check
Access is granted only if both checks pass. Otherwise, the request is denied.
2. Hotlink Validation:
Algorithm: md5sum
Process: A secure hash is calculated using the specified parameters and their combination sequence.
Scope: Applies to all URLs under the matched directory(s).
Failure Action: Requests to unmatched URLs or with failed validation are denied.
3. Time Validity Check:
Process: The system calculates the difference between the current time (converted to YYYYMMDDHHMMSS format) and the plain-text timestamp in the request URL.
Tolerance Window: The request is allowed only if the time difference falls within the configured limit (default is ±60 seconds).
Failure Action: Requests outside the tolerance window are rejected with a 403 error.
4. Logging: URLs that lack the encrypted authentication string will be logged.
5.Clearing Rules: To clear all timestamp hotlink protection rules, submit the empty node: |
path-patternString | The url matching mode supports fuzzy regularization. If all matches, the input parameters can be configured as: *.Verify the time stamp of the matched URL for anti-leeching; reject URLs that are not matched. |
protocol-of-path-patternString | Optional values are: http, https, http;https, noprefix, empty. If it is empty, it defaults to "http;https"; if it is noprefix, it means that the protocol prefix of url is not specified, and it only matches according to the regularity of path-pattern. This configuration item only matches with path-pattern. example: 1. Specify protocol-of-path-pattern=https and path-pattern=.* to match all https requests, but not http requests. 2. Specify protocol-of-path-pattern=http;https, path-pattern=.* to match all http and https requests. 3. Specify protocol-of-path-pattern=noprefix and path-pattern=^http://[^/]+/.* to match all http requests but not https requests. |
directoryString | Directory, multiple separated by English semicolons. Perform timestamp anti-leech verification for the matched directory; reject the unmatched directory. mutually exclusive with path-pattern. |
ignore-uri-slashString | Whether to remove / from $uri in anti-leech, the optional values are true or false, and the default is false, that is, it contains /. For example: http://www.test.com/1.flv, then $uri is /1.flv by default, if ignore-uri-slash is true, then $uri is 1.flv |
ignore-key-and-time-positionString | Whether key and time are allowed to be interchanged, the optional values are true and false, true is allowed, false is not allowed. By default, the order of key parameters and time parameters must strictly follow the order required by the authentication mode, that is, the default key and time cannot be interchanged. If "true" is selected, the key and time positions can be interchanged and the authentication succeeds. |
except-path-patternString | Exceptional url matching mode, except for some URLs: such as abc.jpg, do not do anti-theft chain function |
allowed-ipsString | Exceptional IP, supports input of IP or IP range, separate IP ranges with semicolons (;), such as 1.1.1.0/24;2.2.2.2, some IP exceptions, no anti-leeching. |
encrypt-methodString | Encryption Algorithm. Support value: md5sum |
multiple-secret-keysString | Anti-leech encrypted string, multiple encrypted strings are supported, and multiple encrypted strings are separated by semicolons (;) Example: |
time-formatString | The time format of the anti-leech encryption string,
Year|Month|Day|Hour|Minute|Second:1Y;2m;3d;4H;5M;6S
UNIX timestamp:7s
Millisecond-level UNIX timestamp:7s;9ms
Hexadecimal timestamp:8x
Notice: The format is fixed; numbers and letters must not be changed, and each value can only appear once. |
dst-styleString | Anti-leech back-to-source method, optional values: 1 (use unencrypted url to go back to the source), 2 (use the customer request to return to the source with encrypted string url) Example: |
log-formatString | Logging original url, optional values: true (logging original url), false (do not enable logging original url) |
m3u8String | Used to configure m3u8 Example: |
url-keyString | Used to configure the name of the key in the url Example: |
timestamp-control-rulesList | Timestamp-based hotlink protection - Multiple match patterns
Note: The configuration items for multiple rules are as follows:
1. Protocol for URL matching pattern
2. URL matching pattern
3. Protocol for exception URL matching pattern
4. Exception URL matching pattern
5. Hotlink protection generation method
6. Request URL format
7. For generic hotlink protection: which occurrence of "/" in the URI to use
8. To clear all configurations: pass only the node |
data-idLong | dataId is to indicate a specific group configuration when the client has multiple groups of configurations. |
path-patternString | The url matching mode supports fuzzy regularization. If all matches, the input parameters can be configured as: *.Verify the time stamp of the matched URL for anti-leeching; reject URLs that are not matched. |
except-path-patternString | Exceptional url matching mode, except for some URLs: such as abc.jpg, do not do anti-theft chain function |
path-pattern-protocolString | Protocol, optional values: http|https|http;https|noprefixhttp: http protocolhttps: http protocolhttp;https: http and https protocolsnoprefix: no prefix, according to the rules set by path-patternUsage example:path-pattern: input .*\jpg$path-pattern-protocol: select http, it means ^http://[^/]+/.*\jpg$;If https is selected, it means ^https://[^/]+/ .*\jpg$;Select http;https, it means ^https?://[^/]+/.*\jpg$;If noprefix is selected, it means .*\jpg$Notice:1. When it is empty, the default "http and https protocol"2. Only match the url matching pattern (path-pattern)3. The protocol must be with the mode, but the mode can exist alone |
except-path-pattern-protocolString | Protocol, optional values: http|https|http;https|noprefixhttp: http protocolhttps: http protocolhttp;https: http and https protocolsnoprefix: no prefixUsage example:except-path-pattern: input .*\jpg$except-path-pattern-protocol: select http, it means ^http://[^/]+/.*\jpg$;If https is selected, it means ^https://[^/]+/ .*\jpg$;Select http;https, it means ^https?://[^/]+/.*\jpg$;If noprefix is selected, it means .*\jpg$Notice:1. When it is empty, the default "http and https protocol"2. Only match the exception url matching pattern (except-path-pattern)3. The protocol must be with the mode, but the mode can exist alone |
cipher-combinationString | The anti-leech chain generation method, the parameters involved in the MD5 calculation and the combination sequence only support the following parameters:$uri: A string between domain and question mark, special values are configured in the input parameter |
secret-keyString | The key of the anti-leech encryption string, only one key is allowed to be passed inExample: |
cipher-paramString | Parameter name of the anti-leech stringExample: |
time-paramString | Parameter name for time stringExample: |
lower-limit-expiry-timeString | The lower limit of the expiration time of the anti-leech chainExample: |
upper-limit-expiry-timeString | The upper limit of the expiration time of the anti-leech chainExample: |
request-url-styleString | The anti-leech request url format supports two anti-leech methods, that is, the encrypted string and timestamp are placed after "?" or the encrypted string and timestamp are placed after "host". The parameters supported by the url format are as follows:$domain: domain name$uri: the url part that does not contain the domain name$key: MD5 value of anti-leech encrypted string$time: Anti-leech time string$args: the QUERY_STRING parameter after the question markExample: The following request url format is supported, which can be replaced with https://. The url request protocol is based on actual use. If you don't know how to configure it correctly, please ask customer technical support for assistance; the parameter name carrying two values of encrypted string and time string" keyname" and "tname", which can be replaced by the actual parameter names used |
uri-selectString | The general anti-leech takes the number "/" corresponding to the uri, the value is a number, and multiple values are separated by semicolons.Configure the general anti-leech link to get the number of "/" corresponding to the uri. If the configuration is 0, it is the first one in the forward direction, and -1 is the first one in the reverse direction. It can be configured by channel, and the default value is empty.For example http://a.com/b/c/d/e/f/1.htmlThen 0;3; 4;-1 is to take /b/e/f/1.htmlNotice:1. Value range: [-100,+100]2. Repeat configuration effective rules (it is recommended not to configure duplicates)Duplicates will skip parsing:Such as http://cdn.example.com/e/0/e2/test.dat?k=v |
special-encryptionString | Special encryption, values: 1 to enable, or leave blank |
effective-timeString | Effective time, unit:s |
file-typeString | The file type |
custom-file-typeString | The custom file type |
except-file-typeString | Exceptional file type, multiple values separated by English semicolons (;), optional values: f4m ico m3u8 wmv jpeg shtml wma ts png zip bmp css html txt gif swf js bootstarp rar xml flv exe jpg htm mp4 mp3
Example: |
except-custom-file-typeString | Exceptional custom file type, multiple values separated by English semicolons (;)
Example: |
| Error code(code) | Description(message) | HTTP status | Semantic |
|---|---|---|---|
| InternalError | We encountered an internal error. Please try again. | 500 | We encountered an internal error. Please try again. |
| InvalidParameter | No domain was specified. | 400 | No domain was specified. |
| NoSuchDomain | The specified domain does not exist. | 404 | The specified domain does not exist. |
| NoSuchServiceTag | The specified service tag dose not exist, tag:{}. | 400 | The specified service tag dose not exist, tag:{}. |
#!/bin/bash
username="example_username"
apiKey="example_apiKey"
date=`env LANG="en_US.UTF-8" date -u "+%a, %d %b %Y %H:%M:%S GMT"`
password=`echo -en "$date" | openssl dgst -sha1 -hmac $apiKey -binary | openssl enc -base64`
curl -i --url "https://{@apiDomain}/api/config/timecontrol/a.example.com" \
-X "GET" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \HTTP/1.1 202 Accepted
Date: Fri, 17 May 2017 06:33:26 GMT
Content-Type: application/xml;charset=utf-8
x-cnc-request-id:c54cbbb4-19fe-407a-930c-3988b62ed2fd
{
"domain-id":"3791876",
"domain-name":"www.livestream.1558074757857625.com",
"timestamp-visit-control-rule":{
"path-pattern":"/20/*",
"except-path-pattern":"jhkh sdas",
"allowed-ips":"1.1.1.0/24;2.2.2.2",
"multiple-secret-keys":"key1;key2",
"time-format":"1Y;2m;3d;4H;5M;6S",
"dst-style":"1",
"encrypt-method":"md5sum",
"log-format":"true",
"m3u8":"true",
"url-key":"auth_key",
"special-encryption": "1",
"effective-time": "10",
"specify-file-type":"gif;png;bmp",
"timestamp-control-rules":[
{
"data-id":31462855,
"path-pattern":"/*.jpg",
"except-path-pattern":"/*.png",
"cipher-combination":"$uri$ourkey$time$args{param1}",
"secret-key":"abcdef",
"cipher-param":"keyname",
"time-param":"tname",
"lower-limit-expiry-time":"200",
"upper-limit-expiry-time":"5000",
"request-url-style":"http://$domain/$uri?$args&keyname=$key&tname=$time",
"uri-select":"1;-1"
}
]
}
}