Create Redirection Rule
Create redirection rule for website acceleration.
Request
Request-Line
POST /waap/v1.0/services/{serviceId}/redirections HTTP/1.1
Request Parameters
Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
serviceId | Integer | Mandatory | Service ID. |
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. |
redirectionURL | String | Mandatory | Send an HTTP redirect if this policy matches. |
statusCode | Integer | Mandatory | HTTP response code to use if sending an HTTP redirect. Could be "301/302". |
enabled | Boolean | Optional | Flag indicating whether the rule is active. Default is true. |
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
Response Body
Property name | Type | Required | Description |
---|---|---|---|
ruleId | Integer | Mandatory | Rule ID number for redirection. |
priority | Integer | Mandatory | Priority weight of redirection rule. |
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 | StatusCode.Invalid | StatusCode 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 | Redirection.OperationFailed | The redirection operation failed. |
404 | ServiceId.NotFound | ServiceId is not found. |
409 | Priority.Exist | Priority already exists. |
Examples
Create Redirection Rule
Request
POST /waap/v1.0/services/12345/redirections HTTP/1.1
{
"name": "test",
"matchUrlPath": {
"operator": "prefix",
"patterns": [
"/"
]
},
"matchQueryString": {
"operator": "prefix",
"patterns": [
"name1=1",
"name2=2"
]
},
"priority": 11,
"redirectionURL": "http://www.example.com/404.html",
"statusCode": 301,
"enabled": true
}
Successful Response Body
{
"ruleId": 261703,
"priority": 11
}