You need to enable JavaScript to run this app.
Load Balancer

Load Balancer

Copy page
Download PDF
Forwarding rule
ModifyRules - Modifying a forwarding rule
Copy page
Download PDF
ModifyRules - Modifying a forwarding rule
Call the ModifyRules API to replace the backend server group corresponding to a forwarding rule in a specified HTTP/HTTPS listener, and to modify the description of the forwarding rule.​
Instructions​
  • The maximum number of rules that can be modified in a single API call is 50.​
  • When the ServerGroupId parameter is configured in the CreateRules API, a default forwarding rule is created to forward traffic to the specified backend server group. The default forwarding rule only supports modification of the backend server group.​
  • After August 30, 2021, the default backend server group feature was introduced for layer-7 listeners. Existing layer-7 listeners must configure a default backend server group for the listener by referring to the ModifyListenerAttributes API; otherwise, forwarding rules with empty domain names will be created.​
Debug​
API Explorer
You can initiate calls online through API Explorer without paying attention to the signature generation process and quickly obtain the call results.
​
Request parameters​
In the following table, the "N" in parameters of the type a.N.b indicates the index of the forwarding rule, ranging from 1 to 50. Separate multiple forwarding rules with ampersands (&).​
Action String required Example: ModifyRules​
Action to execute. Set the value to ModifyRules.​
​
Version String required Example: 2020-04-01​
API version. The current version is 2020-04-01.​
​
ListenerId String required Example: lsn-2fek3rgsxhrsw5oxruwec****​
Listener ID.​
You can call the DescribeListeners API to get the listener ID.​
​
Rules.N.RuleId String required Example: rule-2fegss1cplxxc5oxruvvq****​
ID of the forwarding rule.​
You can call the DescribeRules API to get the forwarding rule ID.​
​
Rules.N.ActionType String optional Example: Forward​
The forwarding action of the forwarding rule. Valid values:​
  • Forward: Forward to.​
  • Redirect: Redirect to.​
tip​
  • The forwarding action of the default forwarding rule defaults to Forward and cannot be modified.​
  • When this parameter is set to Redirect and the parameter Rules.N.RedirectConfig.Protocol is the same as the protocol of the listener to which this forwarding rule belongs, the parameters Rules.N.RedirectConfig.Host, Rules.N.RedirectConfig.Path, and Rules.N.RedirectConfig.Port cannot all be empty.​
​
Rules.N.ServerGroupId String optional Example: rsp-bp1o94dp5i6ea****​
Backend server group ID. You can call the DescribeServerGroups API to get the backend server group ID.​
tip​
When the parameter Rules.N.ActionType is set to Forward, this parameter is required.​
​
Rules.N.RedirectConfig.Protocol String optional Example: HTTP​
The protocol for the forwarding rule redirection. Valid values:​
  • HTTP​
  • HTTPS​
tip​
When the value of parameter Rules.N.ActionType is changed from Forward to Redirect, if this parameter is not passed or no value is passed, it defaults to HTTPS.​
​
Rules.N.RedirectConfig.Host String optional Example: www.test.com​
The domain name for the forwarding rule redirection. Currently, only exact domain names are supported. The requirements are as follows:​
  • Must contain at least one '.' but must not start or end with '.'.​
  • Only letters, numbers, '.', and '-' are allowed.​
  • Length limit is 1 to 128 characters.​
  • An exact domain name that conforms to domain name specifications, for example: www.test.com.​
tip​
When the value of parameter Rules.N.ActionType is changed from Forward to Redirect, if this parameter is not passed or no value is passed, it defaults to an empty string, and during actual forwarding, it will be consistent with the request domain name.​
​
Rules.N.RedirectConfig.Path String optional Example: /abc​
The path for the forwarding rule redirection. The requirements are as follows:​
  • Must start with a forward slash "/". The character '/' cannot appear consecutively.​
  • May include letters, numbers, and symbols: '-', '_', '/', '.', '%', '?', '#', '&', and '='.​
  • Length limit is 1 to 128 characters.​
tip​
When the value of parameter Rules.N.ActionType is changed from Forward to Redirect, if this parameter is not passed or no value is passed, it defaults to an empty string, and during actual forwarding, it will be consistent with the request path.​
​
Rules.N.RedirectConfig.Port String optional Example: 443​
The port for the forwarding rule redirection, valid values range from 1 to 65535.​
tip​
When the value of parameter Rules.N.ActionType is changed from Forward to Redirect, if this parameter is not passed or no value is passed, it defaults to an empty string, and during actual forwarding, it will be consistent with the request port.​
​
Rules.N.RedirectConfig.StatusCode String optional Example: 302​
The status code for the forwarding rule redirection. Valid values:​
  • 301: Indicates that the requested resource has been permanently moved to a new URL. The client should use the new URL for subsequent requests.​
  • 302: Indicates that the requested resource has been temporarily moved to a new URL. The client should use the new URL for subsequent requests, but it may change again in the future.​
  • 307: Similar to 302, but requires the client to preserve the request method when redirecting. For example, if the original request is a GET request, it will remain a GET request after redirection.​
  • 308: Similar to 301, but requires the client to keep the request method unchanged when redirecting.​
tip​
When the value of parameter Rules.N.ActionType is changed from Forward to Redirect, if this parameter is not passed or no value is passed, it defaults to 301.​
​
Rules.N.Description String optional Example: rule1​
Description of the forwarding rule. The requirements are as follows:​
  • Must start with a letter, number, or Chinese character. May include letters, numbers, Chinese characters, and the following symbols: commas (,), periods (.), underscores (_), spaces ( ), equal signs (=), hyphens (-), full-width commas ( , ), and full-width periods ( 。 ).​
  • The length limit is 0 to 255 characters.​
tip​
The default forwarding rule does not support modifying this parameter.​
​
​
​
Response parameters​
RequestId String Example: 20210811152539010225146063030****​
Request ID.​
​
​
​
Request examples​
​
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​
​
Response examples​
​
{​
"ResponseMetadata": {​
"RequestId": "20210811152539010225146063030****",​
"Action": "ModifyRules",​
"Version": "2020-04-01",​
"Service": "clb",​
"Region": "cn-beijing"​
},​
"Result": {​
"RequestId": "20210811152539010225146063030****"​
}​
}​
​
Error codes​
This section displays only the error codes of the current API. For more error codes, see Common error codes.​
​
Status code​
Error codes​
Error message​
Notes​
400​
InvalidDefaultRule.UnSupportAction​
The specified Default Rule does not support this action.​
The specified default forwarding rule does not support the current action.​
400​
InvalidDescription.Malformed​
The specified Description is malformed.​
The format specified for Description is invalid.​
400​
InvalidIncorrectOrder.Malformed​
The specified index order is malformed.​
The specified index order parameter format is invalid.​
400​
InvalidLoadBalancer.InvalidStatus​
The specified LoadBalancer is not in the correct status for the request.​
The specified load balancer cannot respond to this request due to its status.​
400​
InvalidRuleRedirectConfig.ActionTypeMismatch​
The specified RedirectConfig not match with ActionType.​
The specified redirection configuration is inconsistent with the forwarding type.​
400​
InvalidRules.ActionType.Malformed​
The specified Rules.ActionType is malformed.​
The specified Rules.ActionType parameter format is invalid.​
400​
InvalidRules.RedirectConfig.Host.Malformed​
The specified Rules.RedirectConfig.Host is malformed.​
The specified Rules.RedirectConfig.Host parameter format is invalid.​
400​
InvalidRules.RedirectConfig.Path.Malformed​
The specified Rules.RedirectConfig.Path is malformed.​
The specified Rules.RedirectConfig.Path parameter format is invalid.​
400​
InvalidRules.RedirectConfig.Port.Malformed​
The specified Rules.RedirectConfig.Port is malformed.​
The specified Rules.RedirectConfig.Port parameter format is invalid.​
400​
InvalidRules.RedirectConfig.Protocol.Malformed​
The specified Rules.RedirectConfig.Protocol is malformed.​
The specified Rules.RedirectConfig.Protocol parameter format is invalid.​
400​
InvalidRules.RedirectConfig.StatusCode.Malformed​
The specified Rules.RedirectConfig.StatusCode is malformed.​
The specified Rules.RedirectConfig.StatusCode parameter format is invalid.​
400​
InvalidServerGroup.ActionTypeMismatch​
The specified ServerGroup not match with ActionType.​
The specified backend server group is inconsistent with the forwarding type.​
400​
InvalidServerGroup.UnSupportAction​
The specified ServerGroup does not support this action.​
The specified Server Group does not support the current action.​
400​
LimitExceeded.Rule​
You've reached the limit on the number of rules that you can operate.​
The upper limit on the number of operable forwarding rules has been reached.​
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'.​
This request is missing a required parameter. Please ensure the request includes all required parameters, such as 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 ''.​
This request is missing a required parameter. Ensure the request includes all required parameters, such as .​
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'.​
This request is missing a required parameter. Please ensure the request includes all required parameters, such as ListenerId.​
400​
UnsupportedOperation.AccountArrears​
The request on the specified instance is denied due to the account in arrears status.​
The action request on this instance is denied because the account is in arrears.​
403​
Forbidden​
You are not authorized to perform operations on the specified service.​
You do not have permission to perform operations on the specified service.​
403​
InvalidResourceType.ServcieManaged​
The specified ResourceType is managed by a service.​
The specified resource is a service-managed resource.​
404​
InvalidExclusiveCluster.NotFound​
The specified ExclusiveCluster does not exist.​
The specified Exclusive Cluster does not exist.​
404​
InvalidListener.NotFound​
The specified Listener does not exist.​
The specified listener does not exist.​
404​
InvalidLoadBalancer.NotFound​
The specified LoadBalancer does not exist.​
The specified load balancer does not exist.​
404​
InvalidRule.NotFound​
The specified Rule does not exist.​
The specified forwarding rule does not exist.​
404​
InvalidServerGroup.NotFound​
The specified ServerGroup does not exist.​
The specified server group does not exist.​
409​
InvalidRule.Conflict​
The specified Rule already exists.​
The specified forwarding rule already exists.​
412​
InvalidExclusiveCluster.Expired​
The specified ExclusiveCluster has expired.​
The specified Exclusive Cluster has expired.​
412​
InvalidExclusiveCluster.UnPurchased​
The specified ExclusiveCluster is not purchased.​
The specified Exclusive Cluster is not purchased.​
412​
InvalidLoadBalancer.Expired​
The specified LoadBalancer has expired.​
The specified CLB has expired.​
500​
InternalError​
An internal error has occurred.​
An internal error occurred.​
​
​
Last updated: 2026.05.09 10:37:00