Edit Cache Control

This API is used to edit cache control for website acceleration or file download service.

1. Request Definition

  • API URL
https://cdn-api.swiftfederation.com/v2.0/services/{serviceId}/cache_controls/{policyId}
  • Request Method
PUT
  • Request Header

Refer to HTTP Request Headers

  • Request Body

Request Body Data Format: JSON

Field Required Type Description
name Mandatory string Policy name for access control.
matchType Mandatory string Policy match type, could be "regex" or "prefix".
match Mandatory string Prefix or regex of url pattern.
priority Optional int Priority weight of access control policy. policy with bigger weight will have higher priority, weight value can not be zero.
ttl Optional long The cache TTL for contents to be cached on edge server in seconds.
allowedReferrers Optional string Comma-separated list of domain suffixes. If the Referer header of a client request does not match any of the suffixes in the list 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 Optional string Comma-separated list of domain suffixes. If the Origin header of a client request does not match any of the suffixes in the list 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 Optional boolean True or false to ignore no-cache header(s) sent by the client.
ignoreOriginNoCache Optional boolean True or false to ignore no-cache header(s) sent by the origin server.
ignoreQueryString Optional boolean True or false to ignore any URL query string when caching contents.
enableXCache Optional 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 Optional boolean Do not cache the content even if the origin presents it as cacheable.
responseHeaders Optional ResponseHeader[] List of response header configuration.
ResponseHeader Definition
operationType Mandatory string Operation type of response header policy, could be "add" or "replace" or "delete"
name Mandatory string Response Header Name.
value Optional string Response Header Value. ignored when Operation type is "delete"
  • Request Body Example
{
    "name": "cc2001",
    "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"
        }
    ]
}


2. Response Definition

  • Response Header

Refer to HTTP Response Headers

  • Response Body
No response body for this API.
           Updated 2024-08-26 07:42:13

results matching ""

    No results matching ""