List Cache Control V2
This API is used to list cache controls for website accleration service.
Request
Request-Line
GET /cdn/v1.1/services/{serviceId}/cacheControl HTTP/1.1
Request Parameters
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| serviceId | Integer | Mandatory | Service id. |
Response
Response Body
| Parameter | Type | Description |
|---|---|---|
| Array | Array of Cache Controls. |
Object: Cache Control
| Parameter | Type | Description |
|---|---|---|
| policyId | String | Policy ID number for cache control. |
| policyName | String | Policy name for cache control. |
| priority | Integer | Priority weight for the rule. Rules with a higher weight take precedence. The weight must be non-zero. |
| matches | Array | Matching configuration that determines which requests the rule applies to. See Matches for details. |
| ignoreClientNoCache | Boolean | True or false to ignore no-cache header(s) sent by the client. Default is false. |
| ignoreOriginNoCache | Boolean | True or false to ignore no-cache header(s) sent by the origin server. Default is false. |
| ignoreQueryString | Boolean | True or false to ignore any URL query string when caching contents. Default is false. |
| enableXCache | Boolean | When enabled all responses from the edge have X-Cache header with values like "HIT from da01.xy01.swiftserve.com", showing whether the response was served from the cache (at least partially) or not. Default is false. |
| noCache | Boolean | Do not cache the content even if the origin presents it as cacheable. Default is false. |
| autoGzip | Boolean | automatic gzipping on the CDN side. Default is false. |
| responseHeaders | Array | List of response header configuration. See Response Headers for details. |
| ttl | Long | The cache TTL for contents to be cached on edge server in seconds. |
| refererAcl | Object | Configure resource references by creating a domain list and selecting a configuration type (e.g.,whitelist,blacklist) to control whether a domain has permission to access the resource,thereby ensuring resource security. see Referer Acl for details |
| originAcl | Object | Configure origins by creating a domain list and selecting a configuration type (e.g.,whitelist,blacklist) to control whether a domain has permission to access data from origin,thereby ensuring resource security. see Origin Acl for details |
| varyMIMEs | String[] | Configures so-called "vary for images" feature.Contains a list of mime types, preferred for objects matched by the policy. |
| enabled | Boolean | Flag defining if policy is active or no. default is true. |
Object: Matches
| Parameter | Type | Description |
|---|---|---|
| Array | See Match for details. |
Object: Match
| Parameter | Type | Description |
|---|---|---|
| field | String | Which part of the request to match. Supported values: • req.path - Request path (excluding query string).• req.query - Request query parameters.• req.method - HTTP method (GET, POST, etc.).• client.ip - Client IP address.• req.host - Request host.• req.header.user-agent - User-Agent header.• req.header.cookie - Cookie header.• req.header.origin - Origin header.• req.header.via - Via header. |
| operator | String | Defines how to match the field. Supported values: • startswith - Succeeds if the what matches one of the prefixes listed in patterns.• not_startswith - Matches if field value does not starts with any of the specified prefixes.• istartswith - Case-independent version of startswith.• not_istartwith - Matches if the field value does not starts with any of the specified prefixes, ignoring letter case differences.• regex - Succeeds if what matches one of the regexes listed in patterns.• equals - Succeeds if the what matches one of the strings listed in patterns.• not_equals - Succeeds if the field value does not exactly match any of the specified strings.• iequals - Case-independent version of equals.• not_iequals - Succeeds if the field value does not exactly match any of the specified strings,ignoring letter case differences.• endswith - Succeeds if the what ends with one of the strings listed in patterns. Useful e.g. to match file extensions like ".mp4".• not_endswith - Succeeds if the what does not ends with one of the strings listed in patterns.• iendswith - Case-independent version of endswith.• not_iendswith - Succeeds if the what does not ends with one of the strings listed in patterns,ignoring letter case differences.• subnet - Succeeds if the what belongs to one of subnets, specified in patterns, like "1.222.94.98/32".• not_subnet - Succeeds if the what does not belongs to one of subnets.Note: subnet operator is applicable only to the client.ip match option. |
| values | String[] | List of values matching the URL path string. |
Object: Referer/Origin Acl
| Parameter | Type | Description |
|---|---|---|
| aclType | String | Types of blacklists and whitelists |
| domainList | String[] | List of domain. |
Object: Response Headers
| Parameter | Type | Description |
|---|---|---|
| name | String | Response Header Name. |
| operationType | String | Operation type of response header policy, could be "add" or "replace" or "delete" |
| value | String | Response Header Value. |
Status Codes, Error Codes and Error Messages
| Status Code | Error Code | Error Message |
|---|---|---|
| 400 | InvalidService.IdIncorrect | Service id is empty or invalid. |
Examples
List Cache Control V2
Request
GET /cdn/v1.1/services/226401/cacheControl HTTP/1.1
Successful Response Body
[
{
"policyId": 262284,
"policyName": "cacheInfo",
"ignoreClientNoCache": false,
"ignoreOriginNoCache": false,
"ignoreQueryString": true,
"enableXCache": true,
"noCache": false,
"autoGzipDisable": false,
"responseHeaders": [
{
"name": "Content-Type",
"value": "application/json",
"operationType": "add"
}
],
"matches": [
{
"field": "req.path",
"operator": "startswith",
"values": [
"/css/",
"/images/abc/"
]
},
{
"field": "req.host",
"operator": "iequals",
"values": [
"expamle.com"
]
},
{
"field": "req.method",
"operator": "equals",
"values": [
"get"
]
}
],
"priority": 4,
"enabled": true
},
{
"policyId": 262285,
"policyName": "cacheInfo",
"ignoreClientNoCache": true,
"ignoreOriginNoCache": false,
"ignoreQueryString": true,
"enableXCache": true,
"noCache": true,
"autoGzipDisable": false,
"responseHeaders": [
{
"name": "Content-Type",
"value": "application/json",
"operationType": "add"
}
],
"matches": [
{
"field": "req.path",
"operator": "startswith",
"values": [
"/css/",
"/images/abc/"
]
},
{
"field": "req.method",
"operator": "equals",
"values": [
"get"
]
}
],
"priority": 5,
"enabled": true
}
]