All Products
Search
Document Center

Anti-DDoS:ModifyWebPreciseAccessRule

Last Updated:Oct 23, 2024

Creates or modifies an accurate access control rule of a website.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
yundun-ddoscoo:ModifyWebPreciseAccessRuleupdate
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ResourceGroupIdstringNo

The ID of the resource group to which the instance belongs in Resource Management. This parameter is empty by default, which indicates that the instance belongs to the default resource group.

rg-acfm2pz25js****
DomainstringYes

The domain name of the website.

Note A forwarding rule must be configured for the domain name. You can call the DescribeDomains operation to query all domain names.
example.aliyundoc.com
RulesstringYes

The settings of the accurate access control rule. This parameter is a JSON string. The following list describes the fields in the value of the parameter:

  • action: the action that is performed if the rule is matched. This field is required and must be of the string type. Valid values:

    • accept: allows the requests that match the rule.
    • block: blocks the requests that match the rule.
    • challenge: implements a CAPTCHA for the requests that match the rule.
  • name: the name of the rule. This field is required and must be of the string type.

  • condition: the match conditions. This field is required and must be of the map type. A match condition contains the following parameters.

    **

    NoteThe AND logical operator is used to define the relationship among multiple match conditions.

    • field: the match field. This parameter is required and must be of the string type.

    • match_method: the logical relation. This parameter is required and must be of the string type.

      **

      NoteFor information about the mappings between the field and match_method parameters, see the Mappings between the field and match_method parameters table in this topic.

    • content: the match content. This parameter is required and must be of the string type.

  • header_name: the HTTP header. This parameter is optional and must be of the string type. This parameter takes effect only when field is header.

[{"action":"block","name":"testrule","condition":[{"field":"uri","match_method":"contain","content":"/test/123"}]}]
ExpiresintegerNo

The validity period of the rule. Unit: seconds. This parameter takes effect only when action of a rule is block. Access requests that match the rule are blocked within the specified validity period of the rule. If you do not specify this parameter, this rule takes effect all the time.

600

Mappings between the field and match_method parameters

fieldDescriptionmatch_method
ipThe source IP address of the request.belong: the Is Part Of relation.nbelong: the Is Not Part Of relation.
uriThe request URI.contain: the Contains relation.ncontain: the Does Not Contain relation.equal: the Equals relation.nequal: the Does Not Equal relation.lless: the Is Shorter Than relation.lequal: the Has a Length Of relation.lgreat: the Is Longer Than relation.regular: The match content is the regular expression of the URI.
refererThe URL of the source page from which the request is redirected.contain: the Contains relation.ncontain: the Does Not Contain relation.equal: the Equals relation.nequal: the Does Not Equal relation.lless: the Is Shorter Than relation.lequal: the Has a Length Of relation.lgreat: the Is Longer Than relation.nexist: the Does Not Exist relation.regular: The match content is the regular expression of the URI.
user-agentThe browser information about the client that initiates the request. The information includes the browser identifier, rendering engine, and version.contain: the Contains relation.ncontain: the Does Not Contain relation.equal: the Equals relation.nequal: the Does Not Equal relation.lless: the Is Shorter Than relation.lequal: the Has a Length Of relation.lgreat: the Is Longer Than relation.regular: The match content is the regular expression of the URI.
paramsThe query string in the request URL. The query string is the part that follows the question mark (?) in the URL. For example, in demo.aliyundoc.com/index.html?action=logi, action=login is the query string.contain: the Contains relation.ncontain: the Does Not Contain relation.equal: the Equals relation.nequal: the Does Not Equal relation.lless: the Is Shorter Than relation.lequal: the Has a Length Of relation.lgreat: the Is Longer Than relation.
cookieThe cookie information in the request.contain: the Contains relation.ncontain: the Does Not Contain relation.equal: the Equals relation.nequal: the Does Not Equal relation.lless: the Is Shorter Than relation.lequal: the Has a Length Of relation.lgreat: the Is Longer Than relation.nexist: the Does Not Exist relation
content-typeThe HTTP content type that is specified for the response. The HTTP content type is known as the Multipurpose Internet Mail Extensions (MIME) type.contain: the Contains relation.ncontain: the Does Not Contain relation.equal: the Equals relation.nequal: the Does Not Equal relation.lless: the Is Shorter Than relation.lequal: the Has a Length Of relation.lgreat: the Is Longer Than relation.
x-forwarded-forThe originating IP address. The HTTP X-Forwarded-For (XFF) header is used to identify the originating IP address of the request that is forwarded by an HTTP proxy or a load balancer. The XFF header is included only in requests that are forwarded by an HTTP proxy or a load balancer.contain: the Contains relation.ncontain: the Does Not Contain relation.equal: the Equals relation.nequal: the Does Not Equal relation.lless: the Is Shorter Than relation.lequal: the Has a Length Of relation.lgreat: the Is Longer Than relation.nexist: the Does Not Exist relation.regular: The match content is the regular expression of the URI.
content-lengthThe number of bytes in the request body.vless: the Is Smaller Than relation.vequal: the Has a Value Of relation.vgreat: the Is Larger Than relation.
post-bodyThe content of the request.contain: the Contains relation.ncontain: the Does Not Contain relation.equal: the Equals relation.nequal: the Does Not Equal relation.regular: The match content is the regular expression of the URI.
http-methodThe request method, such as GET and POST.equal: the Equals relation.nequal: the Does Not Equal relation.
headerThe header of the request, which is used to specify a custom HTTP header.contain: the Contains relation.ncontain: the Does Not Contain relation.equal: the Equals relation.nequal: the Does Not Equal relation.lless: the Is Shorter Than relation.lequal: the Has a Length Of relation.lgreat: the Is Longer Than relation.nexist: the Does Not Exist relation

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request, which is used to locate and troubleshoot issues.

F908E959-ADA8-4D7B-8A05-FF2F67F50964

Examples

Sample success responses

JSONformat

{
  "RequestId": "F908E959-ADA8-4D7B-8A05-FF2F67F50964"
}

Error codes

For a list of error codes, visit the Service error codes.