Creates forwarding rules for HTTP or HTTPS listeners.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | CreateRules |
The operation that you want to perform. Set the value to CreateRules. |
ListenerPort | Integer | Yes | 443 |
The frontend port that is used by the Server Load Balancer (SLB) instance. Valid values: 1 to 65535. |
LoadBalancerId | String | Yes | lb-bp1ca0zt07t934w****** |
The ID of the SLB instance. |
RegionId | String | Yes | cn-hangzhou |
The ID of the region where the SLB instance is created. You can call the DescribeRegions operation to query region IDs. |
RuleList | String | Yes | [{"RuleName":"Rule2","Domain":"test.com","VServerGroupId":"rsp-bp114ni******"}] |
The forwarding rules to be created. A maximum of 10 forwarding rules can be specified in each request. Each forwarding rule contains the following parameters:
Note You must specify at least
Domain or Url . You can also specify both. The combination of Domain and Url must be unique within a listener.
|
ListenerProtocol | String | No | https |
The frontend protocol that is used by the SLB instance. Note This parameter is required when listeners that use different protocols listen on the
same port.
|
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
Rules | Array of Rule |
The list of forwarding rules. |
|
Rule | |||
RuleId | String | rule-bp12jzy0***** |
The ID of the forwarding rule. |
RuleName | String | Rule2 |
The name of the forwarding rule. |
RequestId | String | 9DEC9C28-AB05-4DDF-9A78-6B08EC9CE18C |
The ID of the request. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=CreateRules
&ListenerPort=443
&LoadBalancerId=lb-bp1ca0zt07t934w******
&RegionId=cn-hangzhou
&RuleList=[{"RuleName":"Rule2","Domain":"test.com","VServerGroupId":"rsp-bp114ni******"}]
&<Common request parameters>
Sample success responses
XML
format
<CreateRulesResponse>
<RequestId>D63E42FB-F963-4EE5-9B32-05602BF351F3</RequestId>
<Rules>
<Rule>
<RuleId>rule-bp12jzy******</RuleId>
<RuleName>Rule3</RuleName>
</Rule>
</Rules>
</CreateRulesResponse>
JSON
format
{
"RequestId": "D63E42FB-F963-4EE5-9B32-05602BF351F3",
"Rules": {
"Rule": [
{
"RuleId": "rule-bp12jzy******",
"RuleName": "Rule3"
}
]
}
}
Error codes
HttpCode | Error code | Error message | Description |
---|---|---|---|
400 | DomainExist | rule with same domain and url already exists in specified vip | The error message returned because a forwarding rule with the same domain name and URL is already created for the listener. |
400 | OperationFailed.ListenerStatusNotSupport | The status of the listener does not support this operation. Please try again later. | The error message returned because the listener is in a state that does not support the operation. Try again later. |
For a list of error codes, visit the API Error Center.