List Cache Controls
This API is used to list url cache controls policy for website accleration domain or filedownload service.
1. Request Definition
- API URL
https://cdn-api.swiftfederation.com/v2.0/services/{serviceId}/cache_controls
- Request Method
GET
- Request Header
Refer to HTTP Request Headers
- Request Body
No request body for this API.
2. Response Definition
- Response Header
Refer to HTTP Response Headers
- Response Body
Field | Type | Description |
---|---|---|
id | int | Policy ID number for access control. |
name | string | Policy name for access control. |
matchType | string | Policy match type, could be "regex" or "prefix". |
match | string | Prefix or regex of url pattern. |
priority | int | Priority weight of access control policy. policy with bigger weight will have higher priority, weight value can not be zero. |
ttl | long | The cache TTL for contents to be cached on edge server in seconds. |
allowedReferrers | string | Comma-separated list of domain suffixes. If the Referer header of a client request does not match any of the suffixes in the whitelist then the request is blocked with an HTTP 403 Permission Denied response. Suffixes match any domain name with the same ending, for example "example.com" will match both "www.example.com" and "subdomain.example.com". and if the domain suffixes start with '-', e.g. "-www.example.com", only block the domain suffixes as blacklist and allow others. |
allowedOrigins | string | Comma-separated list of domain suffixes. If the Origin header of a client request does not match any of the suffixes in the whitelist then the request is blocked with an HTTP 403 Permission Denied response. Suffixes match any domain name with the same ending, for example "example.com" will match both "www.example.com" and "subdomain.example.com". and if the domain suffixes start with '-', e.g. "-www.example.com", only block the domain suffixes as blacklist and allow others. |
ignoreClientNoCache | boolean | True or false to ignore no-cache header(s) sent by the client. |
ignoreOriginNoCache | boolean | True or false to ignore no-cache header(s) sent by the origin server. |
ignoreQueryString | boolean | True or false to ignore any URL query string when caching contents. |
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. |
neverCache | boolean | Do not cache the content even if the origin presents it as cacheable. |
responseHeaders | ResponseHeader[] | List of response header configuration. |
ResponseHeader Definition | ||
name | string | Response Header Name. |
value | string | Response Header Value. |
operationType | string | Operation type of response header policy, could be "add" or "replace" or "delete" |
- Response Body Example
[
{
"id": 2001,
"name": "cc1001",
"matchType": "regex",
"match": "/*.js",
"priority": 5,
"ttl": 86400,
"ignoreClientNoCache": true,
"ignoreOriginNoCache": true,
"ignoreQueryString": false,
"enableXCache":true,
"neverCache":true,
"responseHeaders":[
{
"name":"X-foo",
"value":"bar",
"operationType":"add"
}
]
},
{
"id": 2002,
"name": "cc2002",
"matchType": "regex",
"match": "/*.js",
"priority": 3,
"ttl": 86400,
"allowedReferrers":"example1.com",
"ignoreClientNoCache": true,
"ignoreOriginNoCache": true,
"ignoreQueryString": false,
"enableXCache":true,
"neverCache":true
},
{
"id": 2003,
"name": "cc2003",
"matchType": "regex",
"match": "/*.js",
"priority": 2,
"ttl": 86400,
"allowedReferrers":"example1.com",
"ignoreClientNoCache": true,
"ignoreOriginNoCache": true,
"ignoreQueryString": false,
"enableXCache":true,
"neverCache":true
}
]