Modifies the forwarding rule of a specified vServer group.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes SetRule

The operation that you want to perform.

Set the value to SetRule.

RegionId String Yes cn-hangzhou

The ID of the region where the Classic Load Balancer (CLB) instance is deployed.

You can call the DescribeRegions operation to query the region ID.

RuleId String Yes rule-3ejhkt******

The ID of the forwarding rule.

VServerGroupId String Yes rsp-cige6******

The ID of the vServer group with which the forwarding rule is associated.

RuleName String No doctest

The name of the forwarding rule. The name must be 1 to 80 characters in length, and can contain letters, digits, hyphens (-), forward slashes (/), periods (.),and underscores (_).

Note The name of each forwarding rule must be unique within a listener.
ListenerSync String No off

Specifies whether the forwarding rule uses the scheduling algorithm, session persistence, and health check configurations of the listener.

Valid values: on and off.

  • off: does not use the configurations of the listener. You can customize the health check and session persistence configurations for the forwarding rule.
  • on: uses the configurations of the listener.
Scheduler String No wrr

This parameter is required and takes effect only when the ListenerSync parameter is set to off.

The scheduling algorithm. Default value: wrr. Valid values:

  • wrr: Backend servers that have higher weights receive more requests than those that have lower weights.
  • rr: Requests are distributed to backend servers in sequence.
StickySession String No off

This parameter is required and takes effect only when the ListenerSync parameter is set to off.

Specifies whether to enable session persistence. Valid values: on and off.

  • on: enables the feature.
  • off: disables the feature.
StickySessionType String No insert

The method that is used to handle a cookie. This parameter is required and takes effect only when the StickySession parameter is set to on.

Valid values:

  • insert: inserts a cookie.

    CLB inserts the server ID as a cookie into the first HTTP or HTTPS response that is sent to a client. The next request from the client will contain this cookie, and the listener will distribute this request to the recorded backend server.

  • server: rewrites the original cookie.

    When CLB detects a user-defined cookie, it overwrites the original cookie with the user-defined cookie. The next request from the client will contain the user-defined cookie, and the listener will distribute this request to the recorded backend server.

CookieTimeout Integer No 123

The timeout period of the cookie. Unit: seconds.

Valid values: 1 to 86400.

Note This parameter is required and takes effect only when the StickySession parameter is set to on and the StickySessionType parameter is set to insert.
Cookie String No 23ffsa

The cookie to be configured on the backend server.

The cookie must be 1 to 200 characters in length, and can contain ASCII characters and digits. It cannot contain commas (,), semicolons (;), or spaces. It cannot start with a dollar sign ($).

Note This parameter is required and takes effect only when the StickySession parameter is set to on and the StickySessionType parameter is set to server.
HealthCheck String No off

Specifies whether to enable health checks.

Valid values: on and off.

Note This parameter is required and takes effect only when the ListenerSync parameter is set to off.
HealthCheckDomain String No www.domain.com

The domain name that is used for health checks. Valid values:

  • $_ip: The private IP address of each backend server is used for health checks. If this parameter is set to $_ip or is not set, CLB uses the private IP addresses of backend servers as the domain names for health checks.
  • domain: The domain name must be 1 to 80 characters in length, and can contain letters, digits, periods (.),and hyphens (-).
Note This parameter takes effect only when the HealthCheck parameter is set to on.
HealthCheckURI String No /example

The uniform resource identifier (URI) that is used for health checks. This parameter is required and takes effect only when the HealthCheck parameter is set to on.

HealthyThreshold Integer No 4

The number of health checks that an unhealthy backend server must consecutively pass before it can be declared healthy. In this case, the health check state is changed from fail to success.

Valid values: 2 to 10.

Note This parameter is required and takes effect only when the HealthCheck parameter is set to on.
UnhealthyThreshold Integer No 4

The number of health checks that a healthy backend server must consecutively fail before it can be declared unhealthy. In this case, the health check state is changed from success to fail.

Valid values: 2 to 10.

Note This parameter is required and takes effect only when the HealthCheck parameter is set to on.
HealthCheckTimeout Integer No 20

The timeout period of a health check. Unit: seconds. If a backend server does not respond within the specified timeout period, the backend server fails the health check.

Valid values: 1 to 300.

Note This parameter is required and takes effect only when the HealthCheck parameter is set to on.
HealthCheckInterval Integer No 20

The interval between two consecutive health checks. Unit: seconds.

Valid values: 1 to 50.

Note This parameter is required and takes effect only when the HealthCheck parameter is set to on.
HealthCheckHttpCode String No http_2xx

The HTTP status code that indicates a successful health check. Separate multiple HTTP status codes with commas (,). Default value: http_2xx.

Valid values: http_2xx, http_3xx, http_4xx, and http_5xx.

Note This parameter is required and takes effect only when the HealthCheck parameter is set to on.
HealthCheckConnectPort Integer No 80

The port that is used for health checks.

Valid values: 1 to 65535.

Note This parameter takes effect only when the HealthCheck parameter is set to on.

Response parameters

Parameter Type Example Description
RequestId String 9DEC9C28-AB05-4DDF-9A78-6B08EC9CE18C

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Action=SetRule
&RegionId=cn-hangzhou
&RuleId=rule-3ejhkt******
&<Common request parameters>

Sample success responses

XML format

<RequestId>9DEC9C28-AB05-4DDF-9A78-6B08EC9CE18C</RequestId>

JSON format

{
    "RequestId": "9DEC9C28-AB05-4DDF-9A78-6B08EC9CE18C"
}

Error codes

For a list of error codes, visit the API Error Center.