更新转发规则属性,如条件、动作、名称等。
接口说明
-
UpdateRuleAttribute 接口属于异步接口,即系统返回一个请求 ID,但该转发规则属性尚未更新成功,系统后台的更新任务仍在进行。您可以调用 ListRules 查询转发规则属性的更新状态:
当转发规则属性处于 Configuring 状态时,表示转发规则属性正在更新中。
当转发规则属性处于 Available 状态时,表示转发规则属性更新成功。
-
一条转发规则最多支持添加的条件数(RuleConditions)和动作数(RuleActions)如下:
条件数:基础版 5 条、标准版 10 条、WAF 增强版 10 条。
动作数:基础版 3 条,标准版 5 条、WAF 增强版 5 条。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
alb:UpdateRuleAttribute |
update |
*LoadBalancer
*ServerGroup
|
无 | 无 |
请求参数
名称 |
类型 |
必填 |
描述 |
示例值 |
RuleId |
string |
是 |
转发规则 ID。 |
rule-4dp5i6ea**** |
ClientToken |
string |
否 |
客户端 Token,用于保证请求的幂等性。 从您的客户端生成一个参数值,确保不同请求间该参数值唯一。ClientToken 只支持 ASCII 字符。 说明
若您未指定,则系统自动使用 API 请求的 RequestId 作为 ClientToken 标识。每次 API 请求的 RequestId 不一样。 |
5A2CFF0E-5718-45B5-9D4D-70B3FF3898 |
DryRun |
boolean |
否 |
是否只预检此次请求,取值:
|
false |
RuleConditions |
array<object> |
否 |
转发规则条件。 |
|
array<object> |
否 |
转发规则条件。 |
||
CookieConfig |
object |
否 |
Cookie 配置。 |
|
Values |
array |
否 |
Cookie 配置。 |
|
object |
否 |
Cookie 配置。 |
||
Key |
string |
否 |
Cookie 键。长度为 1~100 个字符,支持小写字母、可见字符、星号(*)和半角问号(?),不支持空格和 |
test |
Value |
string |
否 |
Cookie 值。长度为 1~128 个字符,支持小写英文字母、可见字符、星号(*)和半角问号(?),不支持空格和 |
test |
HeaderConfig |
object |
否 |
头字段配置。 |
|
Key |
string |
否 |
头字段键。长度为 1~40 个字符,支持字母、数字、短划线(-)和下划线(_),不支持 Cookie 和 Host。 |
Port |
Values |
array |
否 |
头字段值。 |
|
string |
否 |
头字段值。同一个转发规则条件内头字段值不能重复。命名规则:
|
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 |
否 |
转发路径。命名规则:
|
/test |
|
QueryStringConfig |
object |
否 |
查询字符串配置。 |
|
Values |
array |
否 |
查询字符串列表。最多支持添加 20 个查询字符串。 |
|
object |
否 |
查询字符串结构。 |
||
Key |
string |
否 |
查询字符串键。长度为 1~100 个字符,支持小写字母、可见字符、星号(*)和半角问号(?),不支持空格和 |
test |
Value |
string |
否 |
查询字符串值。长度为 1~128 个字符,支持小写字母、可见字符、星号(*)和半角问号(?),不支持空格和 |
test |
Type |
string |
否 |
转发规则类型。最多支持添加 7 个转发规则类型。取值:
|
Host |
ResponseStatusCodeConfig |
object |
否 |
响应状态码配置。 |
|
Values |
array |
否 |
响应状态码列表。 |
|
string |
否 |
响应状态码。 |
301 |
|
ResponseHeaderConfig |
object |
否 |
标头条件配置。 |
|
Key |
string |
否 |
头字段键。
|
test |
Values |
array |
否 |
头字段值。 |
|
string |
否 |
头字段值。
|
50006 |
|
SourceIpConfig |
object |
否 |
基于源 IP 业务流量匹配。最多支持添加 5 个基于源 IP 业务流量匹配。 |
|
Values |
array |
否 |
添加一个或多个 IP 地址或者 IP 地址段。 |
|
string |
否 |
添加一个或多个 IP 地址或者 IP 地址段。 |
192.168.0.0/32 |
|
RuleActions |
array<object> |
否 |
转发规则动作列表。 |
|
array<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 响应码,仅支持 2xx、4xx、5xx 数字型字符串,x 为任意数字。 |
200 |
ForwardGroupConfig |
object |
否 |
转发组配置。 |
|
ServerGroupTuples |
array |
否 |
转发到的目标服务器组列表。 |
|
object |
否 |
转发到的目的服务器组结构。 |
||
ServerGroupId |
string |
否 |
转发到的目的服务器组 ID。 |
sg--atstuj3rtoptyui**** |
Weight |
integer |
否 |
权重。取值越大,权重越大,表示转发的访问请求更多。取值范围:0~100。
|
30 |
ServerGroupStickySession |
object |
否 |
服务器组之间会话保持。 |
|
Enabled |
boolean |
否 |
是否开启会话保持。取值:
|
false |
Timeout |
integer |
否 |
超时时间。单位:秒。取值范围:1~86400。 |
2 |
InsertHeaderConfig |
object |
否 |
写入头字段配置。 |
|
CoverEnabled |
boolean |
否 |
是否覆盖请求中的值。取值:
|
false |
Key |
string |
否 |
插入的头字段名称,长度为 1~40 个字符,支持大小写字母 a~z、数字、下划线(_)和短划线(-)。InsertHeaderConfig 中的头字段名称不能重复。 说明
不允许将头名称设置为以下字段(不区分大小写): |
key |
Value |
string |
否 |
插入的头字段内容。
|
UserDefined |
ValueType |
string |
否 |
头字段内容类型。取值:
|
UserDefined |
Order |
integer |
否 |
转发规则动作执行的顺序,取值范围:1~50000,按值从小到大执行动作。值不能为空,不能重复。最多支持添加 20 个转发规则动作执行的顺序。 |
1 |
RedirectConfig |
object |
否 |
重定向配置。最多支持添加 20 个重定向。 |
|
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 |
否 |
要跳转的查询字符串。取值:
|
quert |
RewriteConfig |
object |
否 |
重写配置。 |
|
Host |
string |
否 |
内部跳转的目的主机地址。取值:
|
www.example.com |
Path |
string |
否 |
要跳转的路径。取值:
|
/tsdf |
Query |
string |
否 |
内部跳转的查询字符串。取值:
|
quedsa |
Type |
string |
否 |
动作类型。最多支持添加 11 个动作类型。取值:
说明
一个转发规则必须包含有一条 ForwardGroup(转发至)、Redirect(重定向)或 FixedResponse(返回固定响应)转发动作,与其他类型转发动作并存时,必须放在最后执行。 |
ForwardGroup |
TrafficLimitConfig |
object |
否 |
流量限速。 |
|
QPS |
integer |
否 |
每秒请求次数。取值范围:1~1000000。 |
100 |
PerIpQps |
integer |
否 |
单 IP 每秒请求次数。 取值范围:1 ~ 1000000。 说明
如果同时配置 QPS 参数,PerIpQps 参数的取值必须小于 QPS 参数的取值。 |
80 |
TrafficMirrorConfig |
object |
否 |
流量镜像。 |
|
TargetType |
string |
否 |
镜像的目标类型。取值:
|
ForwardGroupMirror |
MirrorGroupConfig |
object |
否 |
流量镜像至服务器组。 |
|
ServerGroupTuples |
array |
否 |
流量镜像至服务器组。 |
|
object |
否 |
流量镜像至服务器组。 |
||
ServerGroupId |
string |
否 |
服务器组 ID。 |
srg-00mkgijak0w4qgz9**** |
RemoveHeaderConfig |
object |
否 |
去除 HTTP 头部配置。 |
|
Key |
string |
否 |
去除的头字段名称,长度为 1~40 个字符,支持大小写字母 a~z、数字、下划线(_)和短划线(-)。头字段名称不能重复用于 RemoveHeader 中。
|
test |
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 |
RuleName |
string |
否 |
转发规则名称。 长度为 2~128 个英文或中文字符,必须以大小字母或中文开头,可包含数字,半角句号(.),下划线(_)和短划线(-)。 |
rule-instance-test |
Priority |
integer |
否 |
规则优先级,取值范围:1~10000。值越小表示优先级越高。 说明
同一个监听内规则优先级必须唯一。 |
10 |
返回参数
名称 |
类型 |
描述 |
示例值 |
object |
更新转发规则属性。 |
||
JobId |
string |
异步任务 ID。 |
72dcd26b-f12d-4c27-b3af-18f6aed5**** |
RequestId |
string |
请求 ID。 |
365F5378-41F6-4AE4-92F8-7FF34B540710 |
示例
正常返回示例
JSON
格式
{
"JobId": "72dcd26b-f12d-4c27-b3af-18f6aed5****",
"RequestId": "365F5378-41F6-4AE4-92F8-7FF34B540710"
}
错误码
HTTP status code |
错误码 |
错误信息 |
描述 |
---|---|---|---|
400 | IncorrectStatus.Rule | The status of %s [%s] is incorrect. | 转发规则的当前状态不支持本次操作。 |
400 | OperationDenied.IpGroupCanNotUsedForMirrorAction | The operation is not allowed because of %s. | 操作被拒绝,原因是%s。 |
400 | OperationDenied.SameGroupForForwardAndMirrorAction | The operation is not allowed because of %s. | 操作被拒绝,原因是%s。 |
400 | OperationDenied.GRPCServerGroup | The operation is not allowed because of %s. | 操作被拒绝,原因是存在绑定本GRPC服务器组的监听没有启用HTTP2.0。 |
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. | 配额%s已超额度限制,目前已使用%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. | 配额%s已超额度限制,目前已使用%s,配额为%s。 |
400 | Mismatch.Protocol | The %s is mismatched for %s and %s. | %s在%s和%s中不匹配。 |
400 | Mismatch.VpcId | The %s is mismatched for %s and %s. | %s在%s和%s中不匹配。 |
400 | OperationDenied.RewriteMissingForwardGroup | The operation is not allowed because of RewriteMissingForwardGroup. | 操作被拒绝,原因是RewriteMissingForwardGroup。 |
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. | 对ServerGroup鉴权失败 |
403 | Forbidden.LoadBalancer | Authentication is failed for %s. | 负载均衡操作鉴权失败。 |
404 | ResourceNotFound.Rule | The specified resource %s is not found. | 资源%s不存在。 |
404 | ResourceNotFound.ServerGroup | The specified resource %s is not found. | 后端服务器组不存在。 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。