Found 0 result in total
Content is empty
If you don't find the content you expect, please try another search term
Last updated:2021-03-17 10:56:24
You can call this operation to configure cache policies for a domain name. No cache policies are configured by default after a domain name is added.
Notes:
The API request contains the specified directory /2016-09-01/domain/SetCacheRuleConfig, common request headers, and operation-specific request parameters. For more information, see the sample request.
Parameter | Required | Type | Description |
---|---|---|---|
DomainId | Yes | String | The ID of the domain name. |
CacheRules | Yes | CacheRule[] | The array of cache policies. The array is ordered. The priorities of items in the array are sorted by input sequence. The cache policy entered first has the top priority. |
Parameter | Required | Type | Description |
---|---|---|---|
CacheRuleType | Yes | String | The type of the cache policy. For more information about the enumeration types, see Usage notes. |
Value | Yes | String | The content of the cache policy. If the type of the cache policy is directory, you can specify only one directory at a time, and the directory must start and end with a slash (/). If the type of the cache policy is exact, you can specify only one exact path at a time, and the exact path must start with a slash (/). If the cache policy type is file_suffix, you can specify multiple file name extensions separated with commas (,). |
CacheEnable | No | String | Specifies whether to enable caching. Valid values: on and off. Default value: on. If the CacheEnable parameter is set to on, the CacheTime parameter is required, and the RespectOrigin parameter is optional. If the CacheEnable parameter is set to off, the CacheTime and RespectOrigin parameters are ignored. |
CacheTime | No | Long | The cache time. Unit: seconds. This parameter is required if the CacheEnable parameter is set to on. |
RespectOrigin | No | String | Specifies whether to follow the configuration of the origin server. Valid values: on and off. Default value: on. |
Sample request
POST method:
POST /2016-09-01/domain/SetCacheRuleConfig
Host: cdn.api.ksyun.com
X-Amz-Date: date
Authorization:authorization string
x-action: SetCacheRuleConfig
x-version: 2016-09-01
Content-Type: application/json
{
"DomainId":"2D09XC0",
"CacheRules":
[{
"CacheRuleType":"directory",
"Value":"/XXX/",
"CacheTime":11,
"RespectOrigin":"",
"CacheEnable":"on"
},
{
"CacheRuleType":"exact",
"Value":"/XXX/XXX.TXT",
"CacheEnable":"off"
}]
}
Sample response
Pure Mode