Updates the attributes of a forwarding rule.

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 UpdateRuleAttribute

The operation that you want to perform.

Set the value to UpdateRuleAttribute.

RuleId String Yes rule4dp5i6ea****

The ID of the forwarding rule.

ClientToken String No 5A2CFF0E-5718-45B5-9D4D-70B3FF3898

The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must ensure that it is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length.

DryRun Boolean No true

Specifies whether to precheck the API request. Valid values:

  • true: only prechecks the API request. If you select this option, the specified endpoint service is not created after the request passes the precheck. The system prechecks the required parameters, request format, and service limits. If the request fails the precheck, the corresponding error message is returned. If the request passes the precheck, the DryRunOperation error code is returned.
  • false (default): checks the request. After the request passes the check, an HTTP_2xx status code is returned and the operation is performed.
RuleConditions Array No

The conditions of the forwarding rule.

CookieConfig Object No

The configuration of the cookie.

Values Array No

The values of the cookie.

Key String No test

The key of the cookie must be 1 to 100 characters in length, and can contain lowercase letters, printable characters, and wildcards such as asterisks (*) and question marks (?). The key cannot contain spaces or the following special characters: # [ ] { } \ | < > &

Value String No test

The value of the cookie must be 1 to 128 characters in length, and can contain lowercase letters, printable characters, and wildcards such as asterisks (*) and question marks (?). The value cannot contain spaces or the following special characters: # [ ] { } \ | < > &

HeaderConfig Object No

The configuration of the header.

Key String No Port

The key of the header. The header key must be 1 to 40 characters in length, and can contain letters, digits, hyphens (-) and underscores (_). The header key does not support Cookie or Host.

Values Array of String No 5006

The value of the header. The value must be 1 to 128 characters in length, and can contain lowercase letters, printable characters whose ASCII value is greater or equal to 32 and small than 127, and wildcards such as asterisks (*) and question marks (?). The header value cannot start or end with a space.

HostConfig Object No

The configuration of the host.

Values Array of String No www.test.com

The host name.

Take note of the following rules when you specify a host name:

  • The host name must be 3 to 128 characters in length, and can contain lowercase letters, digits, hyphens (-), periods (.),and wildcards such as asterisks (*) and question marks (?).
  • The host name must contain at least one period (.), andcannot start or end with a period (.).
  • The rightmost field can contain only letters, asterisks (*) and question marks (?) and cannot contain digits or hyphens (-).
  • Other fields cannot start or end with a hyphen (-). You can include wildcards such as asterisks (*) and question marks (?)anywhere in a field.
MethodConfig Object No

The configuration of the request method.

Values Array of String No PUT

The request method.

Valid values:HEAD, GET, POST, OPTIONS, PUT, PATCH, and DELETE.

PathConfig Object No

The configuration of the path.

Values Array of String No /test

The path.

Valid values: The path must be 1 to 128 characters in length, and start with a forward slash (/). The path can contain letters, digits, asterisks (*), question marks (?)and the following special characters: $ - _ .+ / & ~ @ : It cannot contain the following special characters: " % # ; ! ( ) [ ]^ , " The path is case-sensitive.

QueryStringConfig Object No

The configuration of the query string.

Values Array No

The values of the query string.

Key String No test

They key of the query string.

The key of the query string must be 1 to 100 characters in length, and can contain lowercase letters, printable characters, and wildcards such as asterisks (*) and question marks (?). The key cannot contain spaces or the following special characters: # [ ] { } \ | < > &

Value String No test

The value of the query string.

The value of the query string must be 1 to 128 characters in length, and can contain lowercase letters, printable characters, and wildcards such as asterisks (*) and question marks (?). The value cannot contain spaces or the following special characters: # [ ] { } \ | < > &

Type String No Host

The type of the forwarding rule. Valid values:

  • Host: Requests are forwarded based on the host.
  • Path: Requests are forwarded based on the path.
  • Header: Requests are forwarded based on the HTTP header.
  • QueryString: Requests are forwarded based on the query string.
  • Method: Request are forwarded based on the request method.
  • Cookie: Requests are forwarded based on the cookie.
RuleActions Array No

The actions of the forwarding rule.

FixedResponseConfig Object No

The configuration of the fixed response.

Content String No dssacav

The content of the fixed response. The response cannot exceed 1 KB in size, and can only contain ASCII characters.

ContentType String No text/plain

The format of the fixed response.

Valid values: text/plain, text/css, text/html, application/javascript, and application/json.

HttpCode String No 200

The HTTP status code of the response. The code must be an HTTP_2xx,HTTP_4xx or HTTP_5xx numeric string. x can be any number.

ForwardGroupConfig Object No

The configuration of the destination server groups.

ServerGroupTuples Array No

The destination server groups.

ServerGroupId String No sg--atstuj3rtoptyui****

The IDs of the destination server groups.

InsertHeaderConfig Object No

The configuration of the inserted header.

Key String No key

The name of the inserted header. The name must be 1 to 40 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). You cannot use the name in InsertHeader.

Note You cannot use the following names: slb-id, slb-ip, x-forwarded-for, x-forwarded-proto, x-forwarded-eip, x-forwarded-port, x-forwarded-client-srcport, connection, upgrade, content-length, transfer-encoding, keep-alive, te, host, cookie, remoteip, and authority. These names are not case-sensitive.
Value String No ClientSrcPort

The value of the inserted header:

If the ValueType parameter is set to SystemDefined, the following values are used:

  • ClientSrcPort: The header value is the client port.
  • ClientSrcIp: The header value is the IP address of the client.
  • Protocol: The header value is the protocol (HTTP or HTTPS) of the client request.
  • SLBId: The header value is the ID of the ALB instance.
  • SLBPort: The header value is the listener port of the ALB instance.

If the ValueType parameter is set to UserDefined: The header value must be 1 to 128 characters in length, and can contain lowercase letters, printable characters whose ASCII value is greater than or equal to 32 and smaller than 127, and wildcards such as asterisks (*) and question marks (?). The header value cannot start or end with a space.

If the ValueType parameter is set to ReferenceHeader: The header value must be 1 to 128 characters in length, and can contain lowercase letters, digits, underscores (_), and hyphens (-).

ValueType String No ClientSrcPort

The type of the header value. Valid values:

  • UserDefined: The value is user-defined.
  • ReferenceHeader: The value is referenced from request headers.
  • SystemDefined: The value is system-defined.
Order Integer No 1

The order of the action. Valid values:1 to 50000. The actions are performed in ascending order. The value must be specified and unique.

RedirectConfig Object No

The configuration of the redirect action.

Host String No ww.ali.com

The host name of the destination to which requests are directed.

Take note of the following rules when you specify the host name:

  • The host name must be 3 to 128 characters in length, and can contain letters, digits, hyphens (-), periods (.), asterisks (*), and question marks (?).
  • The host name must contain at least one period (.), andcannot start or end with a period (.).
  • The rightmost field can contain only letters, asterisks (*) and question marks (?) and cannot contain digits or hyphens (-).
  • Other fields cannot start or end with a hyphen (-). You can include wildcards such as asterisks (*) and question marks (?)anywhere in a field.

Default value: ${host}. You cannot use this value together with other characters at the same time.

HttpCode String No 301

The redirect method. Valid values: 301, 302, 303, 307, and 308.

Path String No /test

The path of the destination to which requests are directed.

Valid values: The path must be 1 to 128 characters in length, and start with a forward slash (/). The path can contain letters, digits, asterisks (*), question marks (?)and the following special characters: $ - _ .+ / & ~ @ : It cannot contain the following special characters: " % # ; ! ( ) [ ] ^ , " The path is case-sensitive.

Default value: ${path}. You can also reference ${host}, ${protocol} and ${port}. Each variable can appear only once. You can use the preceding variables at the same time, or use them together with a valid string.

Port String No 10

The port of the destination to which requests are directed.

Valid values: 1 to 63335.

Default value: ${port}. You cannot use this value together with other characters at the same time.

Protocol String No HTTP

The protocol of the destination to which requests are directed.

Valid values: HTTP and HTTPS.

Default value: ${protocol}. You cannot use this value together with other characters at the same time.

Note HTTPS listener can only direct requests to destinations that use HTTPS protocols.
Query String No quert

The query string to which requests are directed.

Valid values: The query string must be 1 to 128 characters in length, can contain letters and printable characters and cannot contain the following special characters: # [ ] { } \ | < > &

Default value: ${query}. You can also reference ${host}, ${protocol} and ${port}. Each variable can appear only once. You can use the preceding variables at the same time, or use them together with a valid string.

RewriteConfig Object No

The configuration of the rewrite action.

Host String No www.al.com

The hostname of the destination to which requests are directed.

Valid values:

  • The host name must be 3 to 128 characters in length, and can contain letters, digits, hyphens (-), periods (.), asterisks (*), and question marks (?).
  • The host name must contain at least one period (.), and cannot start or end with a period (.).
  • The rightmost field can contain only letters, asterisks (*) and question marks (?) and cannot contain digits or hyphens (-).
  • Other fields cannot start or end with a hyphen (-). You can include wildcards such as asterisks (*) and question marks (?)anywhere in a field.

Default value: ${host}. You cannot use this value together with other characters at the same time.

Path String No /tsdf

The path of the destination to which requests are directed.

Valid values: The path must be 1 to 128 characters in length, and start with a forward slash (/). The path can contain letters, digits, asterisks (*), question marks (?)and the following special characters: $ - _ .+ / & ~ @ : It cannot contain the following special characters: " % # ; ! ( ) [ ] ^ , " The path is case-sensitive.

Default value: ${path}. This value can appear only once. You can use it with a valid string.

Query String No quedsa

The query string to which requests are directed.

Valid values: The query string must be 1 to 128 characters in length, can contain letters and printable characters and cannot contain the following special characters: # [ ] { } \ | < > &

Default value: ${query}. This value can appear only once. You can use it with a valid string.

Type String No ForwardGroup

The type of the action. Valid values:

  • ForwardGroup: forwards requests to multiple vServer groups.
  • Redirect: redirects requests.
  • FixedResponse: returns a fixed response.
  • Rewrite: rewrites requests.
  • InsertHeader: inserts headers to requests.

The preceding actions can be classified into two broad types:

  • FinalType: A forwarding rule can contain only one FinalType action, which is executed at last. This type of action can contain only one ForwardGroup,Redirect or FixedResponse action.
  • ExtType: A forwarding rule can contain one or more ExtType actions, which are executed before FinalType actions and need to coexist with the FinalType actions. This type of action can contain multiple InsertHeader actions or one Rewrite action.
RuleName String No rule-instance-test

The name of the forwarding rule. The name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter.

Priority Integer No 10

The priority of the rule. Valid values: 1 to 10000. A smaller value indicates a higher priority.

Note The priority of each rule within the same listener must be unique.

Response parameters

Parameter Type Example Description
JobId String 72dcd26b-f12d-4c27-b3af-18f6aed5****

The ID of the asynchronous task.

RequestId String 365F4154-92F6-4AE4-92F8-7FF34B540710

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Action=UpdateRuleAttribute
&RuleId=rule4dp5i6ea****
&ClientToken=5A2CFF0E-5718-45B5-9D4D-70B3FF3898
&DryRun=true
&RuleConditions=[{"CookieConfig":{"Values":[{"Key":"test","Value":"test"}]},"HeaderConfig":{"Key":"Port","Values":["5006"]},"HostConfig":{"Values":["www.test.com"]},"MethodConfig":{"Values":["PUT"]},"PathConfig":{"Values":["/test"]},"QueryStringConfig":{"Values":[{"Key":"test","Value":"test"}]},"Type":"Host"}]
&RuleActions=[{"FixedResponseConfig":{"Content":"dssacav","ContentType":"text/plain","HttpCode":"200"},"ForwardGroupConfig":{"ServerGroupTuples":[{"ServerGroupId":"sg--atstuj3rtoptyui****"}]},"InsertHeaderConfig":{"Key":"key","Value":"ClientSrcPort","ValueType":"ClientSrcPort"},"Order":1,"RedirectConfig":{"Host":"ww.ali.com","HttpCode":"301","Path":"/test","Port":"10","Protocol":"HTTP","Query":"quert"},"RewriteConfig":{"Host":"www.al.com","Path":"/tsdf","Query":"quedsa"},"Type":"ForwardGroup"}]
&RuleName=rule-instance-test
&Priority=10
&<Common request parameters>

Sample success responses

XML format

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

<UpdateRuleAttributeResponse>
    <JobId>72dcd26b-f12d-4c27-b3af-18f6aed5****</JobId>
    <RequestId>365F4154-92F6-4AE4-92F8-7FF34B540710</RequestId>
</UpdateRuleAttributeResponse>

JSON format

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

{
  "JobId" : "72dcd26b-f12d-4c27-b3af-18f6aed5****",
  "RequestId" : "365F4154-92F6-4AE4-92F8-7FF34B540710"
}

Error codes

HttpCode Error code Error message Description
400 IncorrectStatus.Rule The status of %s [%s] is incorrect. The error message returned because the status of the specified resource %s [%s] is invalid.
400 OperationDenied.IpGroupCanNotUsedForMirrorAction The operation is not allowed because of %s. The error message returned because the operation is not allowed for %s.
400 OperationDenied.SameGroupForForwardAndMirrorAction The operation is not allowed because of %s. The error message returned because the operation is not allowed for %s.
400 OperationDenied.GRPCServerGroup The operation is not allowed because of %s. The error message returned because the operation is not allowed for %s.
400 Conflict.Priority There is already %s having the same configuration with %s. The error message returned because %s exists that has the same configuration with %s.
400 ResourceQuotaExceeded.ServerGroupAttachedNum The quota of %s is exceeded for resource %s, usage %s/%s. The error message returned because the quota %s of the specified resource %s has exhausted. The current usage is %s.
400 ResourceQuotaExceeded.LoadBalancerServersNum The quota of %s is exceeded for resource %s, usage %s/%s. The error message returned because the quota %s of the specified resource %s has exhausted. The current usage is %s.
400 ResourceQuotaExceeded.ServerAddedNum The quota of %s is exceeded for resource %s, usage %s/%s. The error message returned because the quota %s of the specified resource %s has exhausted. The current usage is %s.
400 QuotaExceeded.RuleWildcardsNum The quota of %s is exceeded, usage %s/%s. The error message returned because the usage %s has exceeded the quota %s.
400 QuotaExceeded.RuleMatchEvaluationsNum The quota of %s is exceeded, usage %s/%s. The error message returned because the usage %s has exceeded the quota %s.
400 QuotaExceeded.RuleActionsNum The quota of %s is exceeded, usage %s/%s. The error message returned because the usage %s has exceeded the quota %s.
400 Mismatch.Protocol The %s is mismatched for %s and %s. The error message returned because %s does not correspond to %s and %s.
400 Mismatch.VpcId The %s is mismatched for %s and %s. The error message returned because %s does not correspond to %s and %s.
400 OperationDenied.RewriteMissingForwardGroup The operation is not allowed because of RewriteMissingForwardGroup. The error message returned because the operation is not allowed because of RewriteMissingForwardGroup.
404 ResourceNotFound.Rule The specified resource %s is not found. The error message returned because the specified resource %s does not exist.
404 ResourceNotFound.ServerGroup The specified resource %s is not found. The error message returned because the specified resource %s does not exist.

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