This operation queries the forwarding rules in a specified region.
Try it now
Test
RAM authorization
Action | Access level | Resource type | Condition key | Dependent action |
alb:ListRules | get | *LoadBalancer
| None | None |
Request parameters
Parameter | Type | Required | Description | Example |
NextToken | string | No | The token that is used to retrieve the next page of results. Valid values:
| FFmyTO70tTpLG6I3FmYAXGKPd**** |
MaxResults | integer | No | The maximum number of entries to return. Valid values: 1 to 100. Default value: 20. Note This parameter is optional. | 20 |
| RuleIds | array | No | The IDs of the forwarding rules. You can specify up to 20 forwarding rule IDs. | |
string | No | The forwarding rule ID. | rule-sada****** | |
| ListenerIds | array | No | The listener IDs. You can specify up to 20 listener IDs. | |
string | No | The listener ID. | lsn-i35udpz3pxsmnf**** | |
| LoadBalancerIds | array | No | The SLB instance IDs. You can specify up to 20 instance IDs. | |
string | No | The SLB instance ID. | alb-x30o38azsuj0sx**** | |
Direction | string | No | The direction of the forwarding rule. Valid values:
Note Basic ALB instances do not support the Response type. | Request |
| Tag | array<object> | No | The tags. | |
object | No | The tag. | ||
Key | string | No | The tag key. The tag key can be up to 128 characters in length. It cannot start with `aliyun` or `acs:`, and cannot contain `http://` or `https://`. | env |
Value | string | No | The tag value. The tag value can be up to 128 characters in length. It cannot start with `aliyun` or `acs:`, and cannot contain `http://` or `https://`. | product |
Response elements
Element | Type | Description | Example |
object | The forwarding rules. | ||
MaxResults | integer | The maximum number of entries returned per page. | 50 |
NextToken | string | The token that is used to retrieve the next page of results. Valid values:
| FFmyTO70tTpLG6I3FmYAXGKPd**** |
RequestId | string | The request ID. | CEF72CEB-54B6-4AE8-B225-F876F****** |
| Rules | array<object> | The list of forwarding rules. | |
array<object> | The forwarding rule. | ||
ListenerId | string | The ID of the listener to which the forwarding rule belongs. | lsn-i35udpz3pxsmnf**** |
LoadBalancerId | string | The ID of the SLB instance to which the forwarding rule belongs. | alb-x30o38azsuj0sx**** |
Priority | integer | The priority of the rule. A smaller value indicates a higher priority. Valid values: 1 to 10000. Note The priority of each rule must be unique within a listener. | 1 |
| RuleActions | array<object> | The actions of the forwarding rule. | |
array<object> | The action of the forwarding rule. | ||
| FixedResponseConfig | object | The configuration of the fixed response. | |
Content | string | The fixed response. The response can be up to 1 KB in length and can contain only ASCII characters. | dssacav |
ContentType | string | The format of the fixed response. Valid values: text/plain, text/css, text/html, application/javascript, and application/json. | text/plain |
HttpCode | string | The HTTP status code of the response. Only HTTP_2xx, HTTP_4xx, and HTTP_5xx are supported. x is a digit. | HTTP_2xx |
| ForwardGroupConfig | object | The configuration of the forwarding group. | |
| ServerGroupTuples | array<object> | The destination server groups. | |
object | The destination server group. | ||
ServerGroupId | string | The ID of the destination server group. | sgp-atstuj3rtoptyui**** |
Weight | integer | The weight. Valid values: 0 to 100. | 2 |
| ServerGroupStickySession | object | The session persistence settings for the server groups. | |
Enabled | boolean | Specifies whether to enable session persistence among server groups. This parameter is available when multiple server groups are specified in `ServerGroupTuples`. | |
Timeout | integer | The timeout period for session persistence. This parameter is available when `Enabled` is set to `true`. | 100 |
| InsertHeaderConfig | object | The configuration of the header to be inserted. | |
Key | string | The key of the header to be inserted. The key must be 1 to 40 characters in length. It can contain letters, digits, underscores (_), and hyphens (-). The header key in Note You cannot set the key to Cookie or Host. | key |
Value | string | The value of the header to be inserted.
| ClientSrcPort |
ValueType | string | The type of the header value. Valid values:
| SystemDefined |
Order | integer | The order of the action. Valid values: 1 to 50000. A smaller value indicates a higher priority. The value of this parameter cannot be the same as the value of Order for other actions of the same rule. | 1 |
| RedirectConfig | object | The configuration of the redirection. | |
Host | string | The destination host to which requests are redirected. Valid values:
| www.example.com |
HttpCode | string | The redirection method. Valid values: 301, 302, 303, 307, and 308. | 301 |
Path | string | The destination path to which requests are redirected. Valid values:
| /test |
Port | string | The destination port to which requests are redirected. Valid values:
| 10 |
Protocol | string | The destination protocol to which requests are redirected. Valid values:
Note HTTPS listeners support only HTTPS. | HTTP |
Query | string | The query string of the destination to which requests are redirected. The query string must be 1 to 128 characters in length. It can contain lowercase letters and printable characters. It cannot contain | quert |
| RemoveHeaderConfig | object | The configuration for removing a header. | |
Key | string | The key of the header to be removed. The key must be 1 to 40 characters in length. It can contain letters, digits, underscores (_), and hyphens (-). The header key in RemoveHeader cannot be the same as the key of a header that has been removed.
| key |
| RewriteConfig | object | The configuration of the rewrite. | |
Host | string | The destination host to which requests are redirected. Valid values:
| www.example.com |
Path | string | The destination path to which requests are redirected. The path must be 1 to 128 characters in length. It must start with a forward slash (/). It can contain letters, digits, asterisks (*), question marks (?), and the following special characters: | /tsdf |
Query | string | The query string of the destination to which requests are redirected. The query string must be 1 to 128 characters in length. It can contain lowercase letters and printable characters. It cannot contain | quedsa |
| TrafficMirrorConfig | object | The configuration of traffic mirroring. | |
TargetType | string | The destination of traffic mirroring. The value can be `ForwardGroupMirror`. | ForwardGroupMirror |
| MirrorGroupConfig | object | The server group to which traffic is mirrored. | |
| ServerGroupTuples | array<object> | The server groups to which traffic is mirrored. | |
object | |||
ServerGroupId | string | The server group ID. | sgp-00mkgijak0w4qgz9**** |
Weight | integer | The weight. Valid values: 0 to 100. | 2 |
| TrafficLimitConfig | object | The configuration of throttling. | |
QPS | integer | The queries per second (QPS). Valid values: 1 to 100000. | 4 |
PerIpQps | integer | The QPS of a single IP address. Valid values: 1 to 100000. Note If you set both QPS and PerIpQps, the value of PerIpQps must be smaller than the value of QPS. | 80 |
Type | string | The type of the action. Valid values:
| ForwardGroup |
| CorsConfig | object | The CORS configuration. | |
| AllowOrigin | array | The allowed origins. | |
string | The allowed origins. You can set the value to
| http://test.com | |
| AllowMethods | array | The allowed HTTP methods for cross-origin requests. | |
string | The allowed HTTP methods for cross-origin requests. Valid values:
| GET | |
| AllowHeaders | array | The allowed headers for cross-origin requests. | |
string | The allowed headers for cross-origin requests. You can set the value to | test_123 | |
| ExposeHeaders | array | The headers that can be exposed to the browser. | |
string | The headers that can be exposed to the browser. You can set the value to | test_123 | |
AllowCredentials | string | Specifies whether the browser can send credentials. Valid values:
| on |
MaxAge | integer | The maximum cache time of preflight requests in the browser. Unit: seconds. Valid values: -1 to 172800. | 1000 |
| RuleConditions | array<object> | The conditions of the forwarding rule. | |
array<object> | The condition of the forwarding rule. | ||
| CookieConfig | object | The configuration of the cookie. | |
| Values | array<object> | The cookie values. | |
object | The cookie value. | ||
Key | string | The key of the cookie. The key must be 1 to 100 characters in length. It can contain lowercase letters, printable characters, asterisks (*), and question marks (?). It cannot contain spaces or the following special characters: | test |
Value | string | The value of the cookie. The value must be 1 to 128 characters in length. It can contain lowercase letters, printable characters, asterisks (*), and question marks (?). It cannot contain spaces or the following special characters: | test |
| HeaderConfig | object | The configuration of the header. | |
Key | string | The key of the header. The key must be 1 to 40 characters in length. It can contain letters, digits, hyphens (-), and underscores (_). You cannot set the key to Cookie or Host. | Port |
| Values | array | The header values. | |
string | The value of the header. The value must be 1 to 128 characters in length. It can contain printable characters with ASCII values from | 5006 | |
| HostConfig | object | The configuration of the host. | |
| Values | array | The hostnames. | |
string | The hostname. Naming conventions:
| www.example.com | |
| MethodConfig | object | The configuration of the request method. | |
| Values | array | The request methods. | |
string | The request method. Valid values: HEAD, GET, POST, OPTIONS, PUT, PATCH, and DELETE. | PUT | |
| PathConfig | object | The configuration of the path. | |
| Values | array | The paths. | |
string | The path. The path must be 1 to 128 characters in length. It must start with a forward slash (/). It can contain letters, digits, asterisks (*), question marks (?), and the following special characters: | /test | |
| QueryStringConfig | object | The configuration of the query string. | |
| Values | array<object> | The query strings. | |
object | The query string. | ||
Key | string | The key of the query string. The key must be 1 to 100 characters in length. It can contain lowercase letters, printable characters, asterisks (*), and question marks (?). It cannot contain spaces or the following special characters: | test |
Value | string | The value of the query string. The value must be 1 to 128 characters in length. It can contain lowercase letters, printable characters, asterisks (*), and question marks (?). It cannot contain spaces or the following special characters: | test |
| SourceIpConfig | object | The configuration of the source IP address. | |
| Values | array | The source IP addresses to match. | |
string | Specify one or more IP addresses or CIDR blocks. You can specify up to five source IP addresses for each forwarding rule. | 192.168.XX.XX/32 | |
| ResponseStatusCodeConfig | object | The configuration of the response status code. | |
| Values | array | The response status codes. | |
string | The response status code. | 200 | |
| ResponseHeaderConfig | object | The configuration of the response HTTP header. | |
Key | string | The key of the response HTTP header. The key must be 1 to 40 characters in length. It can contain letters, digits, hyphens (-), and underscores (_). You cannot set the key to Cookie or Host. | key |
| Values | array | The values of the response HTTP header. | |
string | The value of the response HTTP header. The value must be 1 to 128 characters in length. | value | |
Type | string | The type of the forwarding rule. Valid values:
| Host |
RuleId | string | The forwarding rule ID. | rule-bpn0kn908w4nbw**** |
RuleName | string | The name of the forwarding rule. The name must be 2 to 128 characters in length, start with a letter or a Chinese character, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). | rule-instance-test |
RuleStatus | string | The status of the forwarding rule. Valid values:
| Available |
Direction | string | The direction of the forwarding rule. Valid values:
Note Basic ALB instances do not support the Response type. | Request |
| Tags | array<object> | The tags. | |
object | The tag. | ||
Key | string | The tag key. The tag key can be up to 128 characters in length. It cannot start with `aliyun` or `acs:`, and cannot contain `http://` or `https://`. | env |
Value | string | The tag value. The tag value can be up to 128 characters in length. It cannot start with `aliyun` or `acs:`, and cannot contain `http://` or `https://`. | product |
TotalCount | integer | The total number of entries returned. | 1000 |
Examples
Success response
JSON format
{
"MaxResults": 50,
"NextToken": "FFmyTO70tTpLG6I3FmYAXGKPd****",
"RequestId": "CEF72CEB-54B6-4AE8-B225-F876F******",
"Rules": [
{
"ListenerId": "lsn-i35udpz3pxsmnf****",
"LoadBalancerId": "alb-x30o38azsuj0sx****",
"Priority": 1,
"RuleActions": [
{
"FixedResponseConfig": {
"Content": "dssacav",
"ContentType": "text/plain",
"HttpCode": "HTTP_2xx"
},
"ForwardGroupConfig": {
"ServerGroupTuples": [
{
"ServerGroupId": "sgp-atstuj3rtoptyui****",
"Weight": 2
}
],
"ServerGroupStickySession": {
"Enabled": false,
"Timeout": 100
}
},
"InsertHeaderConfig": {
"Key": "key",
"Value": "ClientSrcPort",
"ValueType": "SystemDefined"
},
"Order": 1,
"RedirectConfig": {
"Host": "www.example.com",
"HttpCode": "301",
"Path": "/test",
"Port": "10",
"Protocol": "HTTP",
"Query": "quert"
},
"RemoveHeaderConfig": {
"Key": "key"
},
"RewriteConfig": {
"Host": "www.example.com",
"Path": "/tsdf",
"Query": "quedsa"
},
"TrafficMirrorConfig": {
"TargetType": "ForwardGroupMirror",
"MirrorGroupConfig": {
"ServerGroupTuples": [
{
"ServerGroupId": "sgp-00mkgijak0w4qgz9****",
"Weight": 2
}
]
}
},
"TrafficLimitConfig": {
"QPS": 4,
"PerIpQps": 80
},
"Type": "ForwardGroup",
"CorsConfig": {
"AllowOrigin": [
"http://test.com"
],
"AllowMethods": [
"GET"
],
"AllowHeaders": [
"test_123"
],
"ExposeHeaders": [
"test_123"
],
"AllowCredentials": "on",
"MaxAge": 1000
}
}
],
"RuleConditions": [
{
"CookieConfig": {
"Values": [
{
"Key": "test",
"Value": "test"
}
]
},
"HeaderConfig": {
"Key": "Port",
"Values": [
"5006"
]
},
"HostConfig": {
"Values": [
"www.example.com"
]
},
"MethodConfig": {
"Values": [
"PUT"
]
},
"PathConfig": {
"Values": [
"/test"
]
},
"QueryStringConfig": {
"Values": [
{
"Key": "test",
"Value": "test"
}
]
},
"SourceIpConfig": {
"Values": [
"192.168.XX.XX/32"
]
},
"ResponseStatusCodeConfig": {
"Values": [
"200"
]
},
"ResponseHeaderConfig": {
"Key": "key",
"Values": [
"value"
]
},
"Type": "Host"
}
],
"RuleId": "rule-bpn0kn908w4nbw****",
"RuleName": "rule-instance-test",
"RuleStatus": "Available",
"Direction": "Request",
"Tags": [
{
"Key": "env",
"Value": "product"
}
]
}
],
"TotalCount": 1000
}Error codes
HTTP status code | Error code | Error message | Description |
403 | Forbidden.LoadBalancer | Authentication is failed for %s. | Authentication is failed for %s. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.