You need to enable JavaScript to run this app.
文档中心
负载均衡

负载均衡

复制全文
下载 pdf
转发规则
ModifyRules - 修改转发规则
复制全文
下载 pdf
ModifyRules - 修改转发规则
调用 ModifyRules 接口,更换指定HTTP/HTTPS监听器中转发规则对应的后端服务器组、修改转发规则的描述。​
使用说明​
  • 单次调用API修改规则数量上限为50。​
  • CreateRules接口中配置的ServerGroupId参数会对应创建一个默认的转发规则转发至指定后端服务器组,默认转发规则仅支持修改后端服务器组。​
  • 2021年8月30日后,七层监听器上线默认后端服务器组功能,存量七层监听器需参考 ModifyListenerAttributes 接口为监听器配置默认后端服务器组,否则将创建域名为空的转发规则。​
调试​
API Explorer
您可以通过 API Explorer 在线发起调用,无需关注签名生成过程,快速获取调用结果。
​
请求参数​
下表中,a.N.b类型类型参数中的“N”表示转发规则的序号,取值范围为1 ~ 50。多个转发规则间请使用“&”分隔。​
Action String 必选 示例值:ModifyRules​
要执行的操作,取值:ModifyRules。​
​
Version String 必选 示例值:2020-04-01​
API的版本信息,当前版本为 2020-04-01。​
​
ListenerId String 必选 示例值:lsn-2fek3rgsxhrsw5oxruwec****​
监听器的ID。​
您可以调用DescribeListeners接口,获取监听器ID。​
​
Rules.N.RuleId String 必选 示例值:rule-2fegss1cplxxc5oxruvvq****​
转发规则的ID。​
您可以调用DescribeRules接口,获取转发规则ID。​
​
Rules.N.ActionType String 可选 示例值:Forward​
转发规则的转发动作。取值如下:​
  • Forward:转发至。​
  • Redirect:重定向至。​
说明​
  • 默认转发规则的转发动作默认为Forward,不支持修改。​
  • 该参数取值为Redirect且参数Rules.N.RedirectConfig.Protocol与该转发规则所属监听器协议相同时,参数Rules.N.RedirectConfig.Host、Rules.N.RedirectConfig.Path、Rules.N.RedirectConfig.Port不能均为空。​
​
Rules.N.ServerGroupId String 可选 示例值:rsp-bp1o94dp5i6ea****​
后端服务器组ID。您可以调用DescribeServerGroups接口获取后端服务器组ID。​
说明​
参数Rules.N.ActionType取值为Forward时,该参数为必填。​
​
Rules.N.RedirectConfig.Protocol String 可选 示例值:HTTP​
转发规则重定向的协议。取值如下:​
  • HTTP​
  • HTTPS​
说明​
参数Rules.N.ActionType取值由Forward修改为Redirect时,不传入该参数或该参数不传入数值,则默认为HTTPS。​
​
Rules.N.RedirectConfig.Host String 可选 示例值:www.test.com​
转发规则重定向的域名,当前仅支持精确域名。规范如下:​
  • 需至少包含一个‘.’,且不允许以‘.’开头或结尾。​
  • 仅允许包含字母、数字、‘.’、‘-‘。​
  • 长度限制为1 ~ 128个字符。​
  • 符合域名规范的精确域名,例如:www.test.com。​
说明​
参数Rules.N.ActionType取值由Forward修改为Redirect时,不传入该参数或该参数不传入数值,则默认为空字符串,实际转发时与请求域名保持一致。​
​
Rules.N.RedirectConfig.Path String 可选 示例值:/abc​
转发规则重定向的路径。规范如下:​
  • 必须以正斜线“/”开头,字符‘/’不能连续出现。​
  • 仅允许包含字母、数字、‘-’、‘_’、‘/’、‘.’、‘%’、‘?’、‘#’、‘&’、‘=’等字符。​
  • 长度限制为1 ~ 128个字符。​
说明​
参数Rules.N.ActionType取值由Forward修改为Redirect时,不传入该参数或该参数不传入数值,则默认为空字符串,实际转发时与请求路径保持一致。​
​
Rules.N.RedirectConfig.Port String 可选 示例值:443​
转发规则重定向的端口,取值范围为 1~65535。​
说明​
参数Rules.N.ActionType取值由Forward修改为Redirect时,不传入该参数或该参数不传入数值,则默认为空字符串,实际转发时与请求端口保持一致。​
​
Rules.N.RedirectConfig.StatusCode String 可选 示例值:302​
转发规则重定向的状态码。取值如下:​
  • 301:表示请求的资源已被永久移动到新的 URL,客户端应该使用新的 URL 进行后续请求。​
  • 302:表示请求的资源被临时移动到新的 URL。客户端应该使用新的 URL 进行后续请求,但未来可能会再次更改。​
  • 307:与 302 类似,但在重定向时要求客户端保持请求方法不变。例如,原来是 GET 请求,则重定向后仍然是 GET 请求。​
  • 308:与 301 类似,但在重定向时要求客户端保持请求方法不变。​
说明​
参数Rules.N.ActionType取值由Forward修改为Redirect时,不传入该参数或该参数不传入数值,则默认为301。​
​
Rules.N.Description String 可选 示例值:rule1​
转发规则的描述。规范如下:​
  • 必须以字母、数字或中文开头,可包含字母、数字、中文及以下特殊字符:英文逗号(,)、点号(.)、下划线(_)、空格( )、等号(=)、中划线(-)、中文逗号(,)、中文句号(。)。​
  • 长度限制为0 ~ 255个字符。​
说明​
默认转发规则不支持修改该参数。​
​
​
​
返回参数​
RequestId String 示例值:20210811152539010225146063030****​
请求ID。​
​
​
​
请求示例​
​
GET /?Action=ModifyRules&Version=2020-04-01&ListenerId=lsn-2fek3rgsxhrsw5oxruwec****&Rules.1.RuleId=rule-2fegss1cplxxc5oxruvvq****&Rules.1.ServerGroupId=rsp-bp1o94dp5i6ea****&Rules.1.Description=test HTTP/1.1​
Host: clb.cn-beijing.volcengineapi.com​
X-Date: 20251121T094038Z​
Authorization: HMAC-SHA256 Credential=Adfks******wekfwe/20251121/cn-beijing/clb/request, SignedHeaders=host;x-date, Signature=47a7d934ff7b37c03938******cd7b8278a40a1057690c401e92246a0e41085f​
​
返回示例​
​
{​
"ResponseMetadata": {​
"RequestId": "20210811152539010225146063030****",​
"Action": "ModifyRules",​
"Version": "2020-04-01",​
"Service": "clb",​
"Region": "cn-beijing"​
},​
"Result": {​
"RequestId": "20210811152539010225146063030****"​
}​
}​
​
错误码​
此处仅展示当前API的错误码,更多错误码请参见公共错误码。​
​
状态码​
错误码​
错误信息​
说明​
400​
InvalidDefaultRule.UnSupportAction​
The specified Default Rule does not support this action.​
指定的默认转发规则不支持当前操作。​
400​
InvalidDescription.Malformed​
The specified Description is malformed.​
指定的 Description 参数格式不合法。​
400​
InvalidIncorrectOrder.Malformed​
The specified index order is malformed.​
指定的索引顺序参数格式不合法。​
400​
InvalidLoadBalancer.InvalidStatus​
The specified LoadBalancer is not in the correct status for the request.​
指定的负载均衡所处状态无法响应该请求。​
400​
InvalidRuleRedirectConfig.ActionTypeMismatch​
The specified RedirectConfig not match with ActionType.​
指定的重定向配置与转发类型不一致。​
400​
InvalidRules.ActionType.Malformed​
The specified Rules.ActionType is malformed.​
指定的 Rules.ActionType 参数格式不合法。​
400​
InvalidRules.RedirectConfig.Host.Malformed​
The specified Rules.RedirectConfig.Host is malformed.​
指定的 Rules.RedirectConfig.Host 参数格式不合法。​
400​
InvalidRules.RedirectConfig.Path.Malformed​
The specified Rules.RedirectConfig.Path is malformed.​
指定的 Rules.RedirectConfig.Path 参数格式不合法。​
400​
InvalidRules.RedirectConfig.Port.Malformed​
The specified Rules.RedirectConfig.Port is malformed.​
指定的 Rules.RedirectConfig.Port 参数格式不合法。​
400​
InvalidRules.RedirectConfig.Protocol.Malformed​
The specified Rules.RedirectConfig.Protocol is malformed.​
指定的 Rules.RedirectConfig.Protocol 参数格式不合法。​
400​
InvalidRules.RedirectConfig.StatusCode.Malformed​
The specified Rules.RedirectConfig.StatusCode is malformed.​
指定的 Rules.RedirectConfig.StatusCode 参数格式不合法。​
400​
InvalidServerGroup.ActionTypeMismatch​
The specified ServerGroup not match with ActionType.​
指定的后端服务器组与转发类型不一致。​
400​
InvalidServerGroup.UnSupportAction​
The specified ServerGroup does not support this action.​
指定的后端服务器组不支持当前操作。​
400​
LimitExceeded.Rule​
You've reached the limit on the number of rules that you can operate.​
已达到可操作转发规则的数量上限。​
400​
MissingParameter​
The request is missing a required parameter. Ensure that you have supplied all the required parameters for the request; for example, the 'Rules.RedirectConfig.Host, Rules.RedirectConfig.Path, Rules.RedirectConfig.Port'.​
该请求缺少必要参数。请确保发起请求已提供全部必要参数,比如 Rules.RedirectConfig.Host, Rules.RedirectConfig.Path, Rules.RedirectConfig.Port。​
400​
MissingParameter​
The request is missing a required parameter. Ensure that you have supplied all the required parameters for the request; for example, the ''.​
该请求缺少必要参数。请确保发起请求已提供全部必要参数,比如 。​
400​
MissingParameter​
The request is missing a required parameter. Ensure that you have supplied all the required parameters for the request; for example, the 'ListenerId'.​
该请求缺少必要参数。请确保发起请求已提供全部必要参数,比如 ListenerId。​
400​
UnsupportedOperation.AccountArrears​
The request on the specified instance is denied due to the account in arrears status.​
因账户处于欠费状态,对于该实例的操作请求被拒绝。​
403​
Forbidden​
You are not authorized to perform operations on the specified service.​
无权限对指定服务进行操作。​
403​
InvalidResourceType.ServcieManaged​
The specified ResourceType is managed by a service.​
指定的资源是服务托管资源。​
404​
InvalidExclusiveCluster.NotFound​
The specified ExclusiveCluster does not exist.​
指定的独占集群不存在。​
404​
InvalidListener.NotFound​
The specified Listener does not exist.​
指定的监听器不存在。​
404​
InvalidLoadBalancer.NotFound​
The specified LoadBalancer does not exist.​
指定的负载均衡不存在。​
404​
InvalidRule.NotFound​
The specified Rule does not exist.​
指定的转发规则不存在。​
404​
InvalidServerGroup.NotFound​
The specified ServerGroup does not exist.​
指定的后端服务器组不存在。​
409​
InvalidRule.Conflict​
The specified Rule already exists.​
指定的转发规则已存在。​
412​
InvalidExclusiveCluster.Expired​
The specified ExclusiveCluster has expired.​
指定的独占集群已过期。​
412​
InvalidExclusiveCluster.UnPurchased​
The specified ExclusiveCluster is not purchased.​
指定的独占集群未购买。​
412​
InvalidLoadBalancer.Expired​
The specified LoadBalancer has expired.​
指定的负载均衡已过期。​
500​
InternalError​
An internal error has occurred.​
发生内部错误。​
​
​
最近更新时间:2026.02.13 14:27:46
这个页面对您有帮助吗?
有用
有用
无用
无用