List Cache Controls V3
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/v3.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. |
matchUrlPath | PolicyMatchVO | URL path match rule. |
matchQueryString | PolicyMatchVO | Query string match rule. |
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. |
varyMIMEs | string[] | Configures so-called "vary for images" feature.Contains a list of mime types, preferred for objects matched by the policy. |
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" |
PolicyMatchVO Definition | ||
operator | string | Defines how to match the field. Supported values:prefix,regex,equals,suffix. |
patterns | string[] | List of patterns to match what against. If any of the patterns matches then the match succeeds. |
- Response Body Example
[
{
"id": 2001,
"name": "cc1001",
"matchUrlPath": {"operator":"prefix","patterns":["/"]},
"matchQueryString": {"operator":"prefix","patterns":["name1=1","name2=2"]},
"varyMIMEs":["image/webp","image/avif","image/jpeg"],
"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",
"matchUrlPath": {"operator":"prefix","patterns":["/"]},
"matchQueryString": {"operator":"prefix","patterns":["name1=1","name2=22"]},
"priority": 3,
"ttl": 86400,
"allowedReferrers":"example1.com",
"ignoreClientNoCache": true,
"ignoreOriginNoCache": true,
"ignoreQueryString": false,
"enableXCache":true,
"neverCache":true
},
{
"id": 2003,
"name": "cc2003",
"matchUrlPath": {"operator":"prefix","patterns":["/"]},
"matchQueryString": {"operator":"prefix","patterns":["name1=1","name2=222"]},
"priority": 2,
"ttl": 86400,
"allowedReferrers":"example1.com",
"ignoreClientNoCache": true,
"ignoreOriginNoCache": true,
"ignoreQueryString": false,
"enableXCache":true,
"neverCache":true
}
]