Changes the name, status, or configurations of a protection rule.

Description

  • You can call this operation up to 20 times per second per account.
  • Alibaba Cloud Dynamic Route for CDN (DCDN) supports POST requests.
  • You must configure at least one of the RuleStatus, RuleName and RuleConfig parameters.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ModifyDcdnWafRule

The operation that you want to perform. Set the value to ModifyDcdnWafRule.

RuleId Long Yes 200001

The ID of the protection rule. You can specify only one ID in each request.

RuleStatus String No off

The new status of the protection rule. Valid values:

  • on
  • off
RuleName String No test

The new name of the protection rule.

RuleConfig String No {\"origin\":\"custom\",\"conditions\":[{\"opValue\":\"eq\",\"key\":\"URL\",\"values\":\"/example\"},{\"opValue\":\"eq\",\"key\":\"Header\",\"values\":\"3333\",\"subKey\":\"trt\"}],\"actionExternal\":{},\"action\":\"monitor\",\"ccStatus\":1,\"ratelimit\":{\"target\":\"remote_addr\",\"interval\":\"5\",\"threshold\":\"2\",\"effect\":\"rule\",\"status\":{\"code\":\"404\",\"count\":\"2\"},\"ttl\":\"1800\"}}'

The new configurations of the protection rule.

Note After you modify the configurations of the protection rule, the previous configurations are overwritten.

Response parameters

Parameter Type Example Description
RequestId String CB1A380B-09F0-41BB-3C2B-72F8FD6DA2FE

The ID of the request.

Examples

Sample requests

curl -XPOST 'http(s)://dcdn.aliyuncs.com/?Action=ModifyDcdnWafRule
&RuleId=200001
&RuleStatus=off
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ModifyDcdnWafRuleResponse>
    <RequestId>CB1A380B-09F0-41BB-3C2B-72F8FD6DA2FE</RequestId>
</ModifyDcdnWafRuleResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "CB1A380B-09F0-41BB-3C2B-72F8FD6DA2FE"
}

Error codes

HTTP status code Error code Error message Description
400 InvalidParameter The specified parameter is invalid. The error message returned because the specified parameter value is invalid.
400 Rule.NotExist The specified rule does not exist. The error message returned because the specified protection rule does not exist.
400 RuleConfigs.Malformed The specified RuleConfigs format is invalid. The error message returned because the format of the specified RuleConfigs parameter is invalid.
400 RuleName.AlreadyExists Rule name already exists in specified policy. The error message returned because the rule name already exists in the specified policy.
500 InternalError An internal error occurred; please try again later. The error message returned because an internal error occurred. Try again later. If the error persists, submit a ticket.

For a list of error codes, visit the API Error Center.