Updates a forwarding rule, such as the match condition, action, and name.
Operation description
-
UpdateRuleAttribute is an asynchronous operation. After a request is sent, the system returns a request ID and runs the task in the background. You can call the ListRules operation to query the status of a forwarding rule:
- If a forwarding rule is in the Configuring state, the forwarding rule is being updated.
- If a forwarding rule is in the Available state, the forwarding rule is updated.
-
You can set RuleConditions and RuleActions to add conditions and actions to a forwarding rule. Take note of the following limits on the number of conditions and the number of actions in each forwarding rule:
- Number of conditions: You can specify at most 5 for a basic Application Load Balancer (ALB) instance, at most 10 for a standard ALB instance, and at most 10 for a WAF-enabled ALB instance.
- Number of actions: You can specify at most 3 for a basic ALB instance, at most 5 for a standard ALB instance, and at most 5 for a WAF-enabled ALB instance.
Debugging
Authorization information
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RuleId | string | Yes | The ID of the forwarding rule. | rule-4dp5i6ea**** |
ClientToken | string | No | The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters. Note
If you do not specify this parameter, the system automatically uses the request ID as the client token. The request ID may be different for each request.
| 5A2CFF0E-5718-45B5-9D4D-70B3FF3898 |
DryRun | boolean | No | Specifies whether to perform only a dry run, without performing the actual request. Valid values:
| false |
RuleConditions | array<object> | No | The match conditions of the forwarding rule. | |
object | No | The match condition of the forwarding rule. | ||
CookieConfig | object | No | The key-value pairs of the cookie. | |
Values | array<object> | No | The key-value pairs of the cookie. | |
object | No | The key-value pairs of the cookie. | ||
Key | string | No | The cookie key. The cookie key must be 1 to 100 characters in length, and can contain lowercase letters, printable ASCII characters, asterisks (*), and question marks (?). It cannot contain space characters or the following special characters: | test |
Value | string | No | The cookie value. The cookie value must be 1 to 128 characters in length, and can contain lowercase letters, printable ASCII characters, asterisks (*), and question marks (?). It cannot contain space characters or the following special characters: | test |
HeaderConfig | object | No | The configuration of the header. | |
Key | string | No | The header key. The header key must be 1 to 40 characters in length, and can contain letters, digits, hyphens (-), and underscores (_). Cookie and Host are not supported. | Port |
Values | array | No | The header values. | |
string | No | The header values. The header values within a forwarding rule must be unique. The header value must meet the following requirements:
| 5006 | |
HostConfig | object | No | The configurations of the hosts. | |
Values | array | No | The hostnames. | |
string | No | The hostname. The hostname must meet the following requirements:
| www.example.com | |
MethodConfig | object | No | The configuration of the request method. | |
Values | array | No | The request methods. | |
string | No | The request method. Valid values: HEAD, GET, POST, OPTIONS, PUT, PATCH, and DELETE. | PUT | |
PathConfig | object | No | The configurations of the forwarding URL. | |
Values | array | No | The forwarding URLs. | |
string | No | The URL to which requests are forwarded. The URL must meet the following requirements:
| /test | |
QueryStringConfig | object | No | The configurations of the query strings. | |
Values | array<object> | No | The query strings. You can specify at most 20 query strings. | |
object | No | The query string. | ||
Key | string | No | The key of the query string. The cookie key must be 1 to 100 characters in length, and can contain lowercase letters, printable ASCII characters, asterisks (*), and question marks (?). It cannot contain space characters or the following special characters: | test |
Value | string | No | The value of the query string. The value must be 1 to 128 characters in length, and can contain lowercase letters, printable ASCII characters, asterisks (*), and question marks (?). It cannot contain space characters or the following special characters: | test |
Type | string | No | The type of forwarding rule. You can specify at most seven types of forwarding rule. Valid values:
| Host |
ResponseStatusCodeConfig | object | No | The configurations of the response status codes. | |
Values | array | No | The response status codes. | |
string | No | The response status code. | test | |
ResponseHeaderConfig | object | No | The configuration of headers. | |
Key | string | No | The key of the response header.
| test |
Values | array | No | The values of the header. | |
string | No | The values of the header.
| 50006 | |
SourceIpConfig | object | No | Traffic matching based on source IP addresses. You can specify at most five IP addresses, including CIDR blocks. | |
Values | array | No | You can add one or more IP addresses, including CIDR blocks. | |
string | No | You can add one or more IP addresses, including CIDR blocks. | 192.168.0.0/32 | |
RuleActions | array<object> | No | The actions of the forwarding rule. | |
object | No | The actions of the forwarding rule. | ||
FixedResponseConfig | object | No | The configuration of the custom response. | |
Content | string | No | The content of the response. The content can be up to 1 KB in size, and can contain only ASCII characters. | dssacav |
ContentType | string | No | The content type. Valid values: text/plain, text/css, text/html, application/javascript, and application/json. | text/plain |
HttpCode | string | No | The HTTP status code in responses. Valid values: 2xx, 4xx, 5xx. The value must be a numeric string. x must be a digit. | HTTP_200 |
ForwardGroupConfig | object | No | The configurations of the server groups. | |
ServerGroupTuples | array<object> | No | The server groups to which requests are forwarded. | |
object | No | The server group to which requests are forwarded. | ||
ServerGroupId | string | No | The ID of the server group to which requests are forwarded. | sg--atstuj3rtoptyui**** |
Weight | integer | No | The weight of the server group. A larger value specifies a higher weight. A server group with a higher weight receives more requests. Valid values: 0 to 100.
| 30 |
ServerGroupStickySession | object | No | The configuration of session persistence. | |
Enabled | boolean | No | Specify whether to enable session persistence. Valid values:
| false |
Timeout | integer | No | The timeout period of sessions. Unit: seconds Valid values: 1 to 86400. | 2 |
InsertHeaderConfig | object | No | The configuration of the header to be inserted. | |
CoverEnabled | boolean | No | Specifies whether to overwrite the request header values. Valid values:
| false |
Key | string | No | The key of the header. The key must be 1 to 40 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). The header keys specified by InsertHeaderConfig must be unique. Note
The following header keys are not supported: 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 . The header keys are not case-sensitive.
| key |
Value | string | No | The value of the header to be inserted.
| UserDefined |
ValueType | string | No | The type of the header. Valid values:
| UserDefined |
Order | integer | No | The priority of the action. Valid values: 1 to 50000. A smaller value specifies a higher priority. The actions of a forwarding rule are applied in descending order of priority. This parameter is required. The priority of each action within a forwarding rule must be unique. You can specify at most 20 forwarding rule priorities. | 1 |
RedirectConfig | object | No | The configuration of the redirect action. You can specify at most 20 redirect actions. | |
Host | string | No | The hostname to which requests are redirected. Valid values:
| www.example.com |
HttpCode | string | No | The forwarding method. Valid values: 301, 302, 303, 307, and 308. | 301 |
Path | string | No | The URL to which requests are redirected. Valid values:
| /test |
Port | string | No | The port to which requests are redirected. Valid values:
| 10 |
Protocol | string | No | The redirect protocol. Valid values:
Note
HTTPS listeners support only HTTPS redirects.
| HTTP |
Query | string | No | The query string to which requests are redirected. Valid values:
| quert |
RewriteConfig | object | No | The configuration of the rewrite action. | |
Host | string | No | The hostname to which requests are rewritten. Valid values:
| www.example.com |
Path | string | No | The URL to which requests are redirected. Valid values:
| /tsdf |
Query | string | No | The query string to which requests are redirected. Valid values:
| quedsa |
Type | string | No | The type of the task. You can specify at most 11 types of action. Valid values:
You can specify the last action and the actions that you want to perform before the last action:
| ForwardGroup |
TrafficLimitConfig | object | No | The configuration of the action to throttle traffic. | |
QPS | integer | No | The number of queries per second (QPS). Value range: 1 to 1000000. | 100 |
PerIpQps | integer | No | The number of requests per IP address. Value range: 1 to 1000000. Note
If both the QPS and PerIpQps parameters are specified, make sure that the value of the QPS parameter is smaller than the value of the PerIpQps parameter.
| 80 |
TrafficMirrorConfig | object | No | The configuration of the traffic mirroring action. | |
TargetType | string | No | The type of destination to which network traffic is mirrored. Valid values:
| ForwardGroupMirror |
MirrorGroupConfig | object | No | The server group to which network traffic is mirrored. | |
ServerGroupTuples | array<object> | No | The server group to which network traffic is mirrored. | |
object | No | The server group to which network traffic is mirrored. | ||
ServerGroupId | string | No | The server group ID. | srg-00mkgijak0w4qgz9**** |
RemoveHeaderConfig | object | No | The HTTP header to be removed. | |
Key | string | No | The key of the header to be removed. The header key must be 1 to 40 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). The header keys specified in RemoveHeader must be unique.
| test |
CorsConfig | object | No | The CORS configuration. | |
AllowOrigin | array | No | The trusted origins of CORS requests. One or more values are supported. Asterisks (
| |
string | No | The trusted origin of CORS requests. | http://test.com | |
AllowMethods | array | No | The trusted HTTP methods of CORS requests. | |
string | No | The trusted HTTP method of CORS requests. Valid values:
| GET | |
AllowHeaders | array | No | The trusted headers of CORS requests. | |
string | No | The trusted headers of CORS requests. One or more values are supported. Asterisks ( | test_123 | |
ExposeHeaders | array | No | The headers that can be exposed. | |
string | No | The header that can be exposed. One or more values are supported. Asterisks ( | test_123 | |
AllowCredentials | string | No | Specifies whether to allow credentials to be carried in CORS requests. Valid values:
| on |
MaxAge | long | No | The maximum cache time of dry run requests in the browser. Unit: seconds. Valid values: -1 to 172800. | 1000 |
RuleName | string | No | 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. | rule-instance-test |
Priority | integer | No | The priority of the forwarding rule. Valid values: 1 to 10000. A lower value specifies a higher priority. Note
The priorities of the forwarding rules created for the same listener must be unique.
| 10 |
Response parameters
Examples
Sample success responses
JSON
format
{
"JobId": "72dcd26b-f12d-4c27-b3af-18f6aed5****",
"RequestId": "365F5378-41F6-4AE4-92F8-7FF34B540710"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | IncorrectStatus.Rule | The status of %s [%s] is incorrect. | The status of %s [%s] is incorrect. |
400 | OperationDenied.IpGroupCanNotUsedForMirrorAction | The operation is not allowed because of %s. | The operation is not allowed because of %s. |
400 | OperationDenied.SameGroupForForwardAndMirrorAction | The operation is not allowed because of %s. | The operation is not allowed because of %s. |
400 | OperationDenied.GRPCServerGroup | The operation is not allowed because of %s. | The operation is not allowed because of %s. |
400 | Conflict.Priority | There is already %s having the same configuration with %s. | There is already %s having the same configuration with %s. |
400 | ResourceQuotaExceeded.ServerGroupAttachedNum | The quota of %s is exceeded for resource %s, usage %s/%s. | The quota of %s is exceeded for resource %s, usage %s/%s. |
400 | ResourceQuotaExceeded.LoadBalancerServersNum | The quota of %s is exceeded for resource %s, usage %s/%s. | The quota of %s is exceeded for resource %s. Usage: %s/%s. |
400 | ResourceQuotaExceeded.ServerAddedNum | The quota of %s is exceeded for resource %s, usage %s/%s. | The quota of %s is exceeded for resource %s. Usage: %s/%s. |
400 | QuotaExceeded.RuleWildcardsNum | The quota of %s is exceeded, usage %s/%s. | The quota of %s is exceeded, usage %s/%s. |
400 | QuotaExceeded.RuleMatchEvaluationsNum | The quota of %s is exceeded, usage %s/%s. | The quota of %s is exceeded. Usage: %s/%s. |
400 | QuotaExceeded.RuleActionsNum | The quota of %s is exceeded, usage %s/%s. | The quota of %s is exceeded. Usage: %s/%s. |
400 | Mismatch.Protocol | The %s is mismatched for %s and %s. | The %s is mismatched for %s and %s. |
400 | Mismatch.VpcId | The %s is mismatched for %s and %s. | The %s is mismatched for %s and %s. |
400 | OperationDenied.RewriteMissingForwardGroup | The operation is not allowed because of RewriteMissingForwardGroup. | The operation is not allowed because rewrite is missing the forward group. |
400 | ResourceInConfiguring.Listener | The specified listener is being configured, please try again later. | - |
400 | OperationDenied.ProtocolMustSameForForwardGroupAction | The operation is not allowed because of ProtocolMustSameForForwardGroupAction. | - |
403 | Forbidden.ServerGroup | Authentication has failed for ServerGroup. | - |
403 | Forbidden.LoadBalancer | Authentication is failed for %s. | Authentication is failed for %s. |
404 | ResourceNotFound.Rule | The specified resource %s is not found. | The specified resource %s is not found. |
404 | ResourceNotFound.ServerGroup | The specified resource %s is not found. | The specified resource %s is not found. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2024-01-29 | The Error code has changed | View Change Details |
2024-01-18 | The Error code has changed | View Change Details |
2023-11-09 | The Error code has changed | View Change Details |
2023-09-26 | The Error code has changed | View Change Details |