List Redirection V2
This API is used to list redirection policies for a website accleration service.
Request
Request-Line
GET /cdn/v1.1/services/{serviceId}/redirections HTTP/1.1
Request Parameters
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| serviceId | Integer | Mandatory | The unique identifier of the service. |
Response
Response Body
| Parameter | Type | Description |
|---|---|---|
| Array | Array of Redirection object. |
Object: Redirection
| Parameter | Type | Description |
|---|---|---|
| policyId | Integer | Unique identifier of the created redirection policy. |
| policyName | String | Name of the redirection policy. |
| matches | Array | Matching configuration for the rule. See Matches for details. |
| redirectDestination | String | The destination URL for the redirect. |
| httpCode | Integer | HTTP status code for the redirect. |
| priority | Integer | Priority weight of the rule. |
| enabled | Boolean | Whether the policy is active. |
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 field value matches one of the prefixes listed in patterns.• not_startswith - Matches if field value does not start with any of the specified prefixes.• istartswith - Case-independent version of startswith.• not_istartswith - Matches if the field value does not start with any of the specified prefixes, ignoring letter case differences.• regex - Succeeds if the field value matches one of the regexes listed in patterns.• equals - Succeeds if the field value 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 field value ends with one of the strings listed in patterns. Useful e.g. to match file extensions like ".mp4".• not_endswith - Succeeds if the field value does not end with one of the strings listed in patterns.• iendswith - Case-independent version of endswith.• not_iendswith - Succeeds if the field value does not end with one of the strings listed in patterns, ignoring letter case differences.• subnet - Succeeds if the field value belongs to one of subnets, specified in patterns, like "1.222.94.98/32".• not_subnet - Succeeds if the field value does not belong to one of subnets.Note: subnet operator is applicable only to the client.ip match option. |
| values | Array | List of values to match against the specified field. |
Status Codes, Error Codes and Error Messages
| Status Code | Error Code | Error Message |
|---|---|---|
| 400 | Request.BadRequest | Bad request. |
| 400 | InvalidCustomer.IdEmpty | Customer ID cannot be empty or invalid. |
| 400 | InvalidService.IdIncorrect | Service ID is empty or invalid. |
| 400 | InvalidService.IdPermission | Service ID cannot be found or unknown. |
Examples
List Redirection V2
Request
GET /cdn/v1.1/services/226401/redirections HTTP/1.1
Successful Response Body
[
{
"policyId": 262286,
"policyName": "redo",
"redirectDestination": "www.domain333.com",
"httpCode": 302,
"matches": [
{
"field": "req.path",
"operator": "startswith",
"values": [
"/css/",
"/images/abc/"
]
},
{
"field": "req.host",
"operator": "iequals",
"values": [
"expamle.com"
]
}
],
"priority": 1,
"enabled": true
}
]