查询指定地域的转发规则。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
alb:ListRules |
get |
*LoadBalancer
|
无 | 无 |
请求参数
名称 |
类型 |
必填 |
描述 |
示例值 |
NextToken |
string |
否 |
是否拥有下一次查询的令牌(Token)。取值:
|
FFmyTO70tTpLG6I3FmYAXGKPd**** |
MaxResults |
integer |
否 |
本次读取的最大数据记录数。 取值:1~100。 默认值:20,表示用户没有传入数据。 说明
此参数为可选。 |
20 |
RuleIds |
array |
否 |
转发规则列表,一次最多支持查询 20 个转发规则。 |
|
string |
否 |
转发规则 ID。 |
rule-sada****** |
|
ListenerIds |
array |
否 |
监听 ID 列表。一次最多支持查询 20 个监听。 |
|
string |
否 |
监听 ID。 |
lsn-i35udpz3pxsmnf**** |
|
LoadBalancerIds |
array |
否 |
负载均衡实例 ID 列表。一次最多支持查询 20 个实例。 |
|
string |
否 |
负载均衡实例 ID。 |
alb-x30o38azsuj0sx**** |
|
Direction |
string |
否 |
转发规则的方向。取值:
说明
基础版的 ALB 实例不支持 Response 类型. |
Request |
Tag |
array<object> |
否 |
标签。 |
|
object |
否 |
标签结构。 |
||
Key |
string |
否 |
标签键。最多支持 128 个字符,不能以 aliyun 或 acs:开头,不能包含 http://或 https://。 |
env |
Value |
string |
否 |
标签值。最多支持 128 个字符,不能以 aliyun 或 acs:开头,不能包含 http://或 https://。 |
product |
返回参数
名称 |
类型 |
描述 |
示例值 |
object |
转发规则。 |
||
MaxResults |
integer |
本次请求所返回的最大记录条数。 |
50 |
NextToken |
string |
是否拥有下一次查询的令牌(Token)。取值:
|
FFmyTO70tTpLG6I3FmYAXGKPd**** |
RequestId |
string |
请求 ID。 |
CEF72CEB-54B6-4AE8-B225-F876F****** |
Rules |
array<object> |
转发规则列表。 |
|
object |
转发规则结构。 |
||
ListenerId |
string |
转发规则所属监听 ID。 |
lsn-i35udpz3pxsmnf**** |
LoadBalancerId |
string |
转发规则所属负载均衡实例 ID。 |
alb-x30o38azsuj0sx**** |
Priority |
integer |
规则优先级,取值为1~10000。值越小表示优先级越高。 说明
同一个监听内规则优先级必须唯一。 |
1 |
RuleActions |
array<object> |
转发规则动作列表。 |
|
object |
转发规则动作结构。 |
||
FixedResponseConfig |
object |
固定响应内容配置。 |
|
Content |
string |
返回的固定内容。最大 1 KB 字节,只支持 ASCII 字符。 |
dssacav |
ContentType |
string |
返回固定内容的格式。 取值:text/plain、text/css、text/html、application/javascript或application/json。 |
text/plain |
HttpCode |
string |
返回的 HTTP 响应码,仅支持HTTP_2xx、HTTP_4xx、HTTP_5xx数字型字符串,x 为任意数字。 |
HTTP_2xx |
ForwardGroupConfig |
object |
转发组配置。 |
|
ServerGroupTuples |
array<object> |
转发到的目的服务器组列表。 |
|
object |
转发到的目的服务器组列表。 |
||
ServerGroupId |
string |
转发到的目的服务器组 ID。 |
sgp-atstuj3rtoptyui**** |
Weight |
integer |
权重。取值范围:0~100。 |
2 |
ServerGroupStickySession |
object |
服务器组间会话保持配置 |
|
Enabled |
boolean |
当 ServerGroupTuple.N 数量大于 1 时,可选是否开启在服务器组间的会话保持 |
|
Timeout |
integer |
当 Enabled=True 时,可以配置会话保持的超时时间 |
100 |
InsertHeaderConfig |
object |
写入头字段配置。 |
|
Key |
string |
插入的头字段名称,长度为 1~40 个字符,支持大小写字母 a~z、数字、下划线(_)和短划线(-)。头字段名称不能重复用于 说明
不允许用户在头字段名称中使用 Cookie 和 Host。 |
key |
Value |
string |
插入的头字段内容。
|
ClientSrcPort |
ValueType |
string |
头字段内容类型。取值:
|
SystemDefined |
Order |
integer |
转发规则动作执行的顺序,取值为1~50000,按值从小到大执行动作。值不能为空,不能重复。 |
1 |
RedirectConfig |
object |
重定向配置。 |
|
Host |
string |
要跳转的主机地址。取值:
|
www.example.com |
HttpCode |
string |
跳转方式,取值为 301、302、303、307 或 308。 |
301 |
Path |
string |
要跳转的路径。取值:
|
/test |
Port |
string |
要跳转的端口。取值:
|
10 |
Protocol |
string |
要跳转的协议。取值:
说明
HTTPS 监听仅支持跳转 HTTPS 协议。 |
HTTP |
Query |
string |
要跳转的查询字符串。长度为 1~128 个字符,支持小写字母和可见字符,不支持 |
quert |
RemoveHeaderConfig |
object |
去除 HTTP 头部配置。 |
|
Key |
string |
去除的头字段名称,长度为 1~40 个字符,支持大小写字母 a~z、数字、下划线(_)和短划线(-)。头字段名称不能重复用于 RemoveHeader 中。
|
key |
RewriteConfig |
object |
重写配置。 |
|
Host |
string |
要跳转的主机地址。取值:
|
www.example.com |
Path |
string |
内部跳转的目的路径。长度为 1~128 个字符,以正斜线(/)开头,支持字母、数字、星号(*)、半角问号(?)和 |
/tsdf |
Query |
string |
内部跳转的查询字符串。长度为 1~128 个字符,支持小写字母和可见字符,不支持 |
quedsa |
TrafficMirrorConfig |
object |
流量镜像。 |
|
TargetType |
string |
流量镜像的目的,可以是服务器组 |
ForwardGroupMirror |
MirrorGroupConfig |
object |
流量镜像至服务器组。 |
|
ServerGroupTuples |
array<object> |
流量镜像至服务器组。 |
|
object |
|||
ServerGroupId |
string |
服务器组 ID。 |
sgp-00mkgijak0w4qgz9**** |
Weight |
integer |
权重。取值范围:0~100。 |
2 |
TrafficLimitConfig |
object |
流量限速。 |
|
QPS |
integer |
每秒请求次数。取值范围:1~100000。 |
4 |
PerIpQps |
integer |
单 IP 每秒请求次数。 取值范围:1 ~ 100000。 说明
如果同时配置 QPS 参数,PerIpQps 参数的取值必须小于 QPS 参数的取值。 |
80 |
Type |
string |
动作类型。取值:
|
ForwardGroup |
CorsConfig |
object |
跨域。 |
|
AllowOrigin |
array |
允许的访问来源。 |
|
string |
允许访问的来源。支持配置为
|
http://test.com |
|
AllowMethods |
array |
选择跨域访问时允许的 HTTP 方法。 |
|
string |
选择跨域访问时允许的 HTTP 方法。取值:
|
GET |
|
AllowHeaders |
array |
允许跨域的 Header 列表。 |
|
string |
允许跨域的 Header 列表。支持配置为 |
test_123 |
|
ExposeHeaders |
array |
允许暴露的 Header 列表。 |
|
string |
允许跨域的 Header 列表。支持配置为 |
test_123 |
|
AllowCredentials |
string |
是否允许携带凭证信息。取值:
|
on |
MaxAge |
integer |
预检请求在浏览器的最大缓存时间,单位:秒。 取值范围:-1~172800。 |
1000 |
RuleConditions |
array<object> |
转发规则条件列表。 |
|
object |
转发规则条件结构。 |
||
CookieConfig |
object |
Cookie 配置。 |
|
Values |
array<object> |
Cookie 值。 |
|
object |
Cookie 值。 |
||
Key |
string |
Cookie 键。长度为 1~100 个字符,支持小写字母、可见字符、星号(*)和半角问号(?),不支持空格和 |
test |
Value |
string |
Cookie 值。长度为 1~128 个字符,支持小写字母、可见字符、星号(*)和半角问号(?),不支持空格和 |
test |
HeaderConfig |
object |
头字段配置。 |
|
Key |
string |
头字段键。长度为 1~40 个字符。支持字母 a~z、数字、短划线(-)和下划线(_)。不支持 Cookie 和 Host。 |
Port |
Values |
array |
头字段值。 |
|
string |
头字段值。长度为 1~128 个字符。支持 ASCII 码值 |
5006 |
|
HostConfig |
object |
主机配置。 |
|
Values |
array |
主机名。 |
|
string |
主机名。命名规则:
|
www.example.com |
|
MethodConfig |
object |
请求方法配置。 |
|
Values |
array |
请求方法。 |
|
string |
请求方法。 取值:HEAD、GET、POST、OPTIONS、PUT、PATCH 或 DELETE。 |
PUT |
|
PathConfig |
object |
转发路径配置。 |
|
Values |
array |
转发路径。 |
|
string |
转发路径。长度为 1~128 个字符,以正斜线(/)开头,支持字母、数字、星号(*)、半角问号(?)和 |
/test |
|
QueryStringConfig |
object |
查询字符串配置。 |
|
Values |
array<object> |
查询字符串。 |
|
object |
查询字符串。 |
||
Key |
string |
查询字符串键。长度为 1~100 个字符,支持小写字母、可见字符、星号(*)和半角问号(?),不支持空格和 |
test |
Value |
string |
查询字符串值。长度为 1~128 个字符,支持小写字母、可见字符、星号(*)和半角问号(?),不支持空格和 |
test |
SourceIpConfig |
object |
基于源 IP 业务流量匹配。 |
|
Values |
array |
需要匹配的源 IP 列表。 |
|
string |
添加一个或多个 IP 地址或者 IP 地址段。 一条转发规则中最多支持添加 5 条源 IP。 |
192.168.XX.XX/32 |
|
ResponseStatusCodeConfig |
object |
响应状态码配置。 |
|
Values |
array |
响应状态码列表。 |
|
string |
响应状态码。 |
200 |
|
ResponseHeaderConfig |
object |
响应 HTTP 头部配置。 |
|
Key |
string |
响应 HTTP 头部键。长度为 1~40 个字符。支持字母 a~z、数字、短划线(-)和下划线(_)。不支持 Cookie 和 Host。 |
key |
Values |
array |
响应 HTTP 头部值列表。 |
|
string |
响应 HTTP 头部值。长度为 1~128 个字符。 |
value |
|
Type |
string |
转发规则类型。取值:
|
Host |
RuleId |
string |
转发规则 ID。 |
rule-bpn0kn908w4nbw**** |
RuleName |
string |
转发规则名称。 长度为 2~128 个英文或中文字符,必须以大小字母或中文开头,可包含数字,半角句号(.),下划线(_)和短划线(-)。 |
rule-instance-test |
RuleStatus |
string |
转发规则状态。取值:
|
Available |
Direction |
string |
转发规则的方向。取值:
说明
基础版的 ALB 实例不支持 Response 类型。 |
Request |
Tags |
array<object> |
标签。 |
|
object |
标签结构。 |
||
Key |
string |
标签键。最多支持 128 个字符,不能以 aliyun 或 acs:开头,不能包含 http://或 https://。 |
env |
Value |
string |
标签值。最多支持 128 个字符,不能以 aliyun 或 acs:开头,不能包含 http://或 https://。 |
product |
TotalCount |
integer |
本次请求条件下返回的总数据记录数。 |
1000 |
示例
正常返回示例
JSON
格式
{
"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": true,
"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
}
错误码
HTTP status code |
错误码 |
错误信息 |
描述 |
---|---|---|---|
403 | Forbidden.LoadBalancer | Authentication is failed for %s. | 负载均衡操作鉴权失败。 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。