Updates a forwarding rule's properties, such as its conditions, actions, and name.
Operation description
-
The UpdateRuleAttribute operation is asynchronous. After you send a request, the system returns a request ID and performs the update in the background. You can call ListRules to query the status of the forwarding rule:
If the status is Configuring, the rule is being updated.
If the status is Available, the update is complete.
-
The maximum numbers of conditions (RuleConditions) and actions (RuleActions) for a forwarding rule are as follows:
Conditions: 5 for Basic Edition, 10 for Standard Edition, and 10 for WAF-enabled Edition.
Actions: 3 for Basic Edition, 5 for Standard Edition, and 5 for WAF-enabled Edition.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
alb:UpdateRuleAttribute |
update |
*LoadBalancer
*ServerGroup
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RuleId |
string |
Yes |
The forwarding rule ID. |
rule-4dp5i6ea**** |
| ClientToken |
string |
No |
The client token that is used to ensure the idempotence of the request. You can generate a token from your client. Make sure that the token is unique across different requests. The client token can contain only ASCII characters. Note
If you do not specify this parameter, the system automatically uses the RequestId of the request as the ClientToken. The RequestId of each request is unique. |
5A2CFF0E-5718-45B5-9D4D-70B3FF3898 |
| DryRun |
boolean |
No |
Specifies whether to perform a dry run. Valid values:
|
false |
| RuleConditions |
array<object> |
No |
The forwarding conditions. |
|
|
array<object> |
No |
The forwarding conditions. |
||
| CookieConfig |
object |
No |
The cookie configuration. |
|
| Values |
array<object> |
No |
The cookies. |
|
|
object |
No |
The cookie. |
||
| Key |
string |
No |
The cookie key. The key must be 1 to 100 characters in length and can contain lowercase letters, printable characters, asterisks (*), and question marks (?). The key cannot contain spaces or the following special characters: |
test |
| Value |
string |
No |
The cookie value. The value must be 1 to 128 characters in length and can contain lowercase letters, printable characters, asterisks (*), and question marks (?). The value cannot contain spaces or the following special characters: |
test |
| HeaderConfig |
object |
No |
The HTTP header configuration. |
|
| Key |
string |
No |
The key of the HTTP header. The key must be 1 to 40 characters in length and can contain letters, digits, hyphens (-), and underscores (_). The key cannot be |
Port |
| Values |
array |
No |
The value of the HTTP header. |
|
|
string |
No |
The value of the HTTP header. Within the same forwarding condition, the values for a given header key must be unique. The value must meet the following requirements:
|
5006 |
|
| HostConfig |
object |
No |
The host configuration. |
|
| Values |
array |
No |
The list of hostnames. |
|
|
string |
No |
The hostname. The hostname must meet the following requirements:
|
www.example.com |
|
| MethodConfig |
object |
No |
The request method configuration. |
|
| Values |
array |
No |
The list of request methods. |
|
|
string |
No |
The request method. Valid values: HEAD, GET, POST, OPTIONS, PUT, PATCH, and DELETE. |
PUT |
|
| PathConfig |
object |
No |
The path configuration. |
|
| Values |
array |
No |
The list of paths. |
|
|
string |
No |
The path. The path must meet the following requirements:
|
/test |
|
| QueryStringConfig |
object |
No |
The query string configuration. |
|
| Values |
array<object> |
No |
The list of query strings. You can add up to 20 query strings. |
|
|
object |
No |
The query string. |
||
| Key |
string |
No |
The key of the query string. The key must be 1 to 100 characters in length and can contain lowercase letters, printable characters, asterisks (*), and question marks (?). The key cannot contain spaces 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 characters, asterisks (*), and question marks (?). The value cannot contain spaces or the following special characters: |
test |
| Type |
string |
No |
The type of the forwarding condition. You can specify up to nine types of forwarding conditions. Valid values:
|
Host |
| ResponseStatusCodeConfig |
object |
No |
The configuration of the response status code. |
|
| Values |
array |
No |
The list of response status codes. |
|
|
string |
No |
The response status code. |
301 |
|
| ResponseHeaderConfig |
object |
No |
The configuration of the response header condition. |
|
| Key |
string |
No |
The key of the header.
|
test |
| Values |
array |
No |
The value of the header. |
|
|
string |
No |
The value of the header.
|
50006 |
|
| SourceIpConfig |
object |
No |
The configuration of the source IP condition. You can specify up to five source IP addresses or CIDR blocks. |
|
| Values |
array |
No |
One or more IP addresses or CIDR blocks. |
|
|
string |
No |
An IP address or a CIDR block. |
192.168.0.0/32 |
|
| RuleActions |
array<object> |
No |
The forwarding actions. |
|
|
array<object> |
No |
The forwarding actions. |
||
| FixedResponseConfig |
object |
No |
The configuration of the fixed response. |
|
| Content |
string |
No |
The content of the fixed response. The content can be up to 1 KB in size and can contain only ASCII characters. |
dssacav |
| ContentType |
string |
No |
The format of the fixed response. Valid values: text/plain, text/css, text/html, application/javascript, and application/json. |
text/plain |
| HttpCode |
string |
No |
The HTTP response code. Valid values are 2xx, 4xx, and 5xx. x is a digit from 0 to 9. |
200 |
| ForwardGroupConfig |
object |
No |
The server group configuration. |
|
| ServerGroupTuples |
array<object> |
No |
The list of destination server groups. |
|
|
object |
No |
The destination server group. |
||
| ServerGroupId |
string |
No |
The ID of the destination server group. |
sg--atstuj3rtoptyui**** |
| Weight |
integer |
No |
The weight of the server group. A larger value indicates a higher weight. This means that the server group receives more requests. Valid values: 0 to 100.
|
30 |
| ServerGroupStickySession |
object |
No |
Session persistence among server groups. |
|
| Enabled |
boolean |
No |
Specifies whether to enable session persistence. Valid values:
|
false |
| Timeout |
integer |
No |
The timeout period, in seconds. Valid values: 1 to 86400. |
2 |
| InsertHeaderConfig |
object |
No |
The configuration for inserting an HTTP header. |
|
| CoverEnabled |
boolean |
No |
Specifies whether to overwrite the value of a request header that has the same key. Valid values:
|
false |
| Key |
string |
No |
The key of the header to be inserted. The key must be 1 to 40 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). The key in InsertHeaderConfig must be unique. Note
The following header keys are not supported (case-insensitive): |
key |
| Value |
string |
No |
The value of the header to be inserted.
|
UserDefined |
| ValueType |
string |
No |
The type of the header value. Valid values:
|
UserDefined |
| Order |
integer |
No |
The execution order of forwarding rule actions. The value can range from 1 to 50000. Actions are executed in ascending order of their values. Each value must be unique and cannot be empty. You can add a maximum of 20 forwarding rule actions. |
1 |
| RedirectConfig |
object |
No |
The redirection configuration. You can specify up to 20 redirections. |
|
| Host |
string |
No |
The destination host. Valid values:
|
www.example.com |
| HttpCode |
string |
No |
The redirection method. Valid values: 301, 302, 303, 307, and 308. |
301 |
| Path |
string |
No |
The destination path. Valid values:
|
/test |
| Port |
string |
No |
The destination port. Valid values:
|
10 |
| Protocol |
string |
No |
The destination protocol. Valid values:
Note
HTTPS listeners support redirection only to HTTPS. |
HTTP |
| Query |
string |
No |
The destination query string. Valid values:
|
quert |
| RewriteConfig |
object |
No |
The rewrite configuration. |
|
| Host |
string |
No |
The destination host to which requests are rewritten. Valid values:
|
www.example.com |
| Path |
string |
No |
The destination path. Valid values:
|
/tsdf |
| Query |
string |
No |
The destination query string for the rewrite. Valid values:
|
quedsa |
| Type |
string |
No |
The action type. You can specify up to nine action types. Valid values:
Note
A forwarding rule must contain a ForwardGroup, Redirect, or FixedResponse action. When used with other action types, one of these actions must be performed last. |
ForwardGroup |
| TrafficLimitConfig |
object |
No |
The traffic throttling configuration. |
|
| QPS |
integer |
No |
The number of queries per second (QPS). Valid values: 1 to 1,000,000. |
100 |
| PerIpQps |
integer |
No |
The number of queries per second (QPS) allowed per IP address. Valid values: 1 to 1,000,000. Note
If you specify both QPS and PerIpQps, the value of PerIpQps must be smaller than the value of QPS. |
80 |
| TrafficMirrorConfig |
object |
No |
The traffic mirroring configuration. |
|
| TargetType |
string |
No |
The type of the destination to which traffic is mirrored. Valid values:
|
ForwardGroupMirror |
| MirrorGroupConfig |
object |
No |
The server group to which traffic is mirrored. |
|
| ServerGroupTuples |
array<object> |
No |
The server group to which traffic is mirrored. |
|
|
object |
No |
The server group to which traffic is mirrored. |
||
| ServerGroupId |
string |
No |
The ID of the server group. |
srg-00mkgijak0w4qgz9**** |
| RemoveHeaderConfig |
object |
No |
The configuration for removing an HTTP header. |
|
| Key |
string |
No |
The key of the header to be removed. The key must be 1 to 40 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). The key must be unique within a
|
test |
| CorsConfig |
object |
No |
The Cross-Origin Resource Sharing (CORS) configuration. |
|
| AllowOrigin |
array |
No |
The list of allowed origins. You can specify only one
|
|
|
string |
No |
Allowed access sources. |
http://test.com |
|
| AllowMethods |
array |
No |
Select the HTTP methods to allow for cross-origin access. |
|
|
string |
No |
Select the HTTP methods allowed for cross-origin resource sharing (CORS). The valid values are:
|
GET |
|
| AllowHeaders |
array |
No |
The list of headers allowed for cross-origin resource sharing (CORS). |
|
|
string |
No |
The list of headers that are allowed for cross-origin requests. You can set this parameter to the wildcard character ( |
test_123 |
|
| ExposeHeaders |
array |
No |
The list of headers that can be exposed. |
|
|
string |
No |
The list of headers that are allowed to be exposed. You can set this to |
test_123 |
|
| AllowCredentials |
string |
No |
Specifies whether to include credentials. Valid values:
|
on |
| MaxAge |
integer |
No |
The maximum cache duration for a preflight request in the browser, in seconds. Valid values: -1 to 172800. |
1000 |
| RuleName |
string |
No |
The name of the forwarding rule. The name must be 2 to 128 characters long and start with a letter, a Chinese character, or a number. It can contain numbers, periods (.), underscores (_), hyphens (-), and spaces. |
rule-instance-test |
| Priority |
integer |
No |
The priority of the rule ranges from 1 to 10000. A smaller value indicates a higher priority. Note
Rule priorities must be unique within the same listener. |
10 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Updates the attributes of a specified forwarding rule for an Application Load Balancer (ALB). |
||
| JobId |
string |
The asynchronous task ID. |
72dcd26b-f12d-4c27-b3af-18f6aed5**** |
| RequestId |
string |
The request ID. |
365F5378-41F6-4AE4-92F8-7FF34B540710 |
Examples
Success response
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. | |
| 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. | |
| 400 | Conflict.Priority | 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. | |
| 400 | ResourceQuotaExceeded.LoadBalancerServersNum | 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. | |
| 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. | |
| 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. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.