Updates the properties of a forwarding rule, such as its conditions, actions, and name.
Operation description
UpdateRuleAttribute is an asynchronous operation. After you send a request, 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, its properties are being updated.
If a forwarding rule is in the Available state, its properties have been updated.
The maximum number of conditions (RuleConditions) and actions (RuleActions) that you can add to 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. Generate a parameter value from your client to make sure that the value is unique among 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 API request as the ClientToken. The RequestId may be different for each API request. | 5A2CFF0E-5718-45B5-9D4D-70B3FF3898 |
DryRun | boolean | No | Specifies whether to perform a dry run. Valid values:
| false |
| RuleConditions | array<object> | No | The conditions of the forwarding rule. | |
array<object> | No | The conditions of the forwarding rule. | ||
| CookieConfig | object | No | The cookie configuration. | |
| Values | array<object> | No | The cookies. | |
object | No | The cookie configuration. | ||
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 (?). It cannot contain spaces or any of 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 (?). It cannot contain spaces or any of the following special characters: | test |
| HeaderConfig | object | No | The request header configuration. | |
Key | string | No | The request header key. The 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 request header value. | |
string | No | The request header value. The values of the same request header key cannot be the same within a forwarding rule condition. Naming conventions:
| 5006 | |
| HostConfig | object | No | The host configuration. | |
| Values | array | No | The list of hostnames. | |
string | No | The hostname. Naming conventions:
| 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 forwarding paths. | |
string | No | The forwarding path. Naming conventions:
| /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 structure of the query string. | ||
Key | string | No | The query string key. The key must be 1 to 100 characters in length and can contain lowercase letters, printable characters, asterisks (*), and question marks (?). It cannot contain spaces or any of the following special characters: | test |
Value | string | No | The query string value. The value must be 1 to 128 characters in length and can contain lowercase letters, printable characters, asterisks (*), and question marks (?). It cannot contain spaces or any of the following special characters: | test |
Type | string | No | The type of the forwarding rule condition. You can add up to seven types of forwarding rule conditions. Valid values:
| Host |
| ResponseStatusCodeConfig | object | No | The configuration of the HTTP status code. | |
| Values | array | No | The list of HTTP status codes. | |
string | No | The HTTP status code. | 301 | |
| ResponseHeaderConfig | object | No | The configuration of the 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 | Matches service traffic based on the source IP address. You can add up to five source IP addresses. | |
| Values | array | No | One or more IP addresses or CIDR blocks. | |
string | No | One or more IP addresses or CIDR blocks. | 192.168.0.0/32 | |
| RuleActions | array<object> | No | The actions of the forwarding rule. | |
array<object> | No | The actions of the forwarding rule. | ||
| FixedResponseConfig | object | No | The configuration of the fixed response. | |
Content | string | No | The fixed response. The response can be up to 1 KB in length 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 status code. The value must be a string that consists of digits. Valid values: 2xx, 4xx, and 5xx. x is a digit. | 200 |
| ForwardGroupConfig | object | No | The configuration of the server group. | |
| 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. 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 | Session persistence for the server group. | |
Enabled | boolean | No | Specifies whether to enable session persistence. Valid values:
| false |
Timeout | integer | No | The timeout period. Unit: seconds. Valid values: 1 to 86400. | 2 |
| InsertHeaderConfig | object | No | The configuration for inserting a request 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 request header to be inserted. The key must be 1 to 40 characters in length, and can contain lowercase letters, digits, underscores (_), and hyphens (-). The key in InsertHeaderConfig cannot be the same as the key in RemoveHeaderConfig. Note The following header keys are not supported: | 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 order of the action. Valid values: 1 to 50000. A smaller value specifies a higher priority. The value must be unique and cannot be empty. You can specify up to 20 orders for the actions. | 1 |
| RedirectConfig | object | No | The redirection configuration. You can add up to 20 redirections. | |
Host | string | No | The destination hostname. 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 only HTTPS. | HTTP |
Query | string | No | The destination query string. Valid values:
| quert |
| RewriteConfig | object | No | The rewrite configuration. | |
Host | string | No | The destination hostname for the internal redirect. Valid values:
| www.example.com |
Path | string | No | The destination path. Valid values:
| /tsdf |
Query | string | No | The destination query string for the internal redirect. Valid values:
| quedsa |
Type | string | No | The action type. You can add up to 11 action types. Valid values:
Note A forwarding rule must contain a ForwardGroup, Redirect, or FixedResponse action. If you want to use these actions with other types of actions, you must make sure that these actions are executed last. | ForwardGroup |
| TrafficLimitConfig | object | No | The throttling configuration. | |
QPS | integer | No | The number of queries per second (QPS). Valid values: 1 to 1000000. | 100 |
PerIpQps | integer | No | The QPS of a single IP address. Valid values: 1 to 1000000. 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 a request header. | |
Key | string | No | The key of the request header to be removed. The key must be 1 to 40 characters in length, and can contain lowercase letters, digits, underscores (_), and hyphens (-). The key cannot be used in RemoveHeaderConfig more than once.
| test |
| CorsConfig | object | No | The CORS configuration. | |
| AllowOrigin | array | No | The list of allowed origins. You can specify only one
| |
string | No | The allowed origin. | http://test.com | |
| AllowMethods | array | No | The allowed HTTP methods for cross-origin requests. | |
string | No | The allowed HTTP methods for cross-origin requests. Valid values:
| GET | |
| AllowHeaders | array | No | The list of allowed headers for cross-origin requests. | |
string | No | The list of allowed headers for cross-origin requests. You can specify | test_123 | |
| ExposeHeaders | array | No | The list of headers that can be exposed to the client. | |
string | No | The list of headers that can be exposed to the client. You can specify | test_123 | |
AllowCredentials | string | No | Specifies whether to allow credentials. Valid values:
| on |
MaxAge | integer | No | The maximum cache time for preflight 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 (-). It must start with a letter or a Chinese character. | rule-instance-test |
Priority | integer | No | The priority of the rule. Valid values: 1 to 10000. A smaller value specifies a higher priority. Note The priorities of rules that belong to the same listener must be unique. | 10 |
Response elements
Element | Type | Description | Example |
object | Updates the attributes of the specified forwarding rule. | ||
JobId | string | The ID of the asynchronous task. | 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.