Update Cache Control Rule
Update cache control rule for website acceleration.
Request
Request-Line
PUT /waap/v1.0/services/{serviceId}/cacheControls/{ruleId} HTTP/1.1
Request Parameters
Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
serviceId | Integer | Mandatory | Service ID. |
ruleId | Integer | Mandatory | Rule ID number for access control. |
Body Parameters
Parameter | Type | Required | Description |
---|---|---|---|
name | String | Mandatory | Rule name for access control. |
matchUrlPath | Object | Mandatory | URL path matching configuration that determines which requests the rule applies to. See Match Url Path for details. |
matchQueryString | Object | Optional | Query-string matching configuration used to refine which requests the rule applies to. See Match Query String for details. |
priority | Integer | Optional | Priority weight for the rule. Rules with a higher weight take precedence. The weight must be non-zero. |
ttl | Long | Optional | Time-to-live (TTL) in seconds for content cached at the edge. If omitted, the origin cache TTL is used. |
ignoreClientNoCache | Boolean | Optional | True or false to ignore no-cache header(s) sent by the client. Default is false. |
ignoreOriginNoCache | Boolean | Optional | True or false to ignore no-cache header(s) sent by the origin server. Default is false. |
ignoreQueryString | Boolean | Optional | True or false to ignore any URL query string when caching contents. Default is false. |
enableXCache | Boolean | Optional | 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. |
neverCache | Boolean | Optional | Do not cache the content even if the origin presents it as cacheable. Default is false. |
varyMIMEs | String[] | Optional | Configures so-called "vary for images" feature.Contains a list of mime types, preferred for objects matched by the rule. Supported values: image/webp, image/avif, image/jpeg, image/jpg, image/png |
enabled | Boolean | Optional | Flag indicating whether the rule is active. |
Object: Match Url Path
Parameter | Type | Required | Description |
---|---|---|---|
operator | String | Mandatory | Defines how to match the field. Supported values:prefix,regex,equals,suffix. |
patterns | String[] | Mandatory | List of patterns to match what against. If any of the patterns matches then the match succeeds. |
Object: Match Query String
Parameter | Type | Required | Description |
---|---|---|---|
operator | String | Mandatory | Defines how to match the field. Supported values:prefix,regex,equals,suffix. |
patterns | String[] | Mandatory | List of patterns to match what against. If any of the patterns matches then the match succeeds. |
Response
Status Codes, Error Codes and Error Messages
Status Code | Error Code | Error Message |
---|---|---|
400 | Request.BadRequest | Bad request. |
400 | ServiceId.Invalid | ServiceId is empty or invalid. |
400 | Name.Invalid | Name is empty or invalid. |
400 | Priority.Invalid | Priority is empty or invalid. |
400 | Ttl.Invalid | Ttl is empty or invalid. |
400 | MatchUrlPath.operator.Invalid | MatchUrlPath.operator is empty or invalid. |
400 | MatchUrlPath.patterns.Invalid | MatchUrlPath.patterns is empty or invalid. |
400 | MatchQueryString.operator.Invalid | MatchQueryString.operator is empty or invalid. |
400 | CacheControl.OperationFailed | The cache control operation failed. |
404 | ServiceId.NotFound | ServiceId is not found. |
409 | Priority.Exist | Priority already exists. |
Examples
Update Cache Control Rule
Request
PUT /waap/v1.0/services/12345/cacheControls/261700 HTTP/1.1
{
"name": "test",
"matchUrlPath": {
"operator": "prefix",
"patterns": [
"/"
]
},
"matchQueryString": {
"operator": "prefix",
"patterns": [
"name1=1",
"name2=2"
]
},
"priority": 1000,
"ttl": 100,
"ignoreClientNoCache": true,
"ignoreOriginNoCache": false,
"ignoreQueryString": false,
"enableXCache": false,
"neverCache": false,
"varyMIMEs": [
"image/jpg"
]
}