Creates an HTTP listener.
Newly created listeners are in the Stopped state.
After a listener is created, you must call the StartLoadBalancerListener operation to enable the listener to forward traffic.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | CreateLoadBalancerHTTPListener |
The operation that you want to perform. Set the value to CreateLoadBalancerHTTPListener. |
HealthCheck | String | Yes | on |
Specifies whether to enable health checks. Valid values: on and off. |
ListenerPort | Integer | Yes | 80 |
The frontend port that is used by the SLB instance. Valid values: 1 to 65535. |
LoadBalancerId | String | Yes | lb-bp1c9vixxjh92q83tw***** |
The ID of the SLB instance. |
StickySession | String | Yes | off |
Specifies whether to enable session persistence. Valid values: on and off. |
RegionId | String | Yes | cn-hangzhou |
The region where the SLB instance is created. You can query the region ID from the Regions and zones list or by calling the DescribeRegions operation. |
Bandwidth | Integer | No | -1 |
The maximum bandwidth of the listener. Unit: Mbit/s. Valid values:
Note This parameter applies to only mainland China.
|
BackendServerPort | Integer | No | 80 |
The backend port that is used by the SLB instance. Valid values: 1 to 65535. Note If the VServerGroupId parameter is not set, this parameter is required.
|
XForwardedFor | String | No | on |
Specifies whether to use the X-Forwarded-For header to obtain the real IP address of the client. Set the value to on. |
Scheduler | String | No | wrr |
The scheduling algorithm. Valid values:
|
StickySessionType | String | No | insert |
The method that is used to handle the cookie. Valid values:
|
CookieTimeout | Integer | No | 500 |
The timeout period of a cookie. Valid values: 1 to 86400. Unit: seconds. Note If you set the StickySession parameter to on and the StickySessionType parameter to insert, this parameter is required.
|
Cookie | String | No | B490B5EBF6F3CD402E515D22BCDA1598 |
The cookie to be configured on the backend server. The name must be 1 to 200 characters in length, and can contain only ASCII letters and digits. It cannot contain commas (,), semicolons (;), or spaces. It cannot start with a dollar sign ($). Note If you set the StickySession parameter to on and the StickySessionType parameter to server, this parameter is required.
|
HealthCheckDomain | String | No | 172.16.**. ** |
The domain name that is used for health check. Valid values:
Note This parameter takes effect only when the HealthCheck parameter is set to on.
|
HealthCheckURI | String | No | /test/index.html |
The URI that is used for health checks. The URI must be 1 to 80 characters in length and can contain only letters, digits, and special characters. %? Supported special characters are " - / . % # &. The URL must start with a forward slash (/) and must not contain only a forward slash. Note This parameter takes effect only when the HealthCheck parameter is set to on.
|
HealthyThreshold | Integer | No | 4 |
The number of consecutive successful health checks that must occur before a backend server is declared healthy (from fail to success). Valid values: 2 to 10. Note This parameter only takes effect when the HealthCheck parameter is set to on.
|
UnhealthyThreshold | Integer | No | 4 |
TThe number of consecutive failed health checks that must occur before a backend server is declared unhealthy. (from success to fail). Valid values: 2 to 10. Note This parameter only takes effect when the HealthCheck parameter is set to on.
|
HealthCheckTimeout | Integer | No | 3 |
The time period to wait for a health check response. If a backend server does not respond within the specified time period, the health check fails. This parameter only takes effect when the HealthCheck parameter is set to on. Valid values: 1 to 300. Note If the value of the HealthCHeckTimeout parameter is smaller than that of the HealthCheckInterval parameter, the value of the HealthCHeckTimeout parameter is ignored and the value of the HealthCheckInterval parameter is regarded as the waiting period.
|
HealthCheckConnectPort | Integer | No | 80 |
The port of the backend server that is used for health check. Valid values: 1 to 65535. Note This parameter only takes effect when the HealthCheck parameter is set to on.
|
HealthCheckInterval | Integer | No | 5 |
The interval between two consecutive health checks. Valid values: 1 to 50. Unit: seconds. Note This parameter only takes effect when the HealthCheck parameter is set to on.
|
HealthCheckHttpCode | String | No | http_2xx,http_3xx |
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 only takes effect when the HealthCheck parameter is set to on.
|
VServerGroupId | String | No | rsp-cige6j***** |
The ID of the VServer group. |
XForwardedFor_SLBIP | String | No | on |
Specifies whether to use the Valid values: on and off. Default value: off. |
XForwardedFor_SLBID | String | No | on |
Specifies whether to use the Valid values: on and off. Default value: off. |
XForwardedFor_proto | String | No | on |
Specifies whether to use the Valid values: on and off. Default value: off. |
Gzip | String | No | on |
Specifies whether to enable Gzip compression to compress files of a specific type. Default value: on. Valid values: on and off. |
AclId | String | No | 123 |
The ID of the Access Control List (ACL) to which the listener is bound. This parameter is required when the AclStatus parameter is set to on. |
AclType | String | No | white |
The type of ACL. Valid values: white and black.
This parameter is required when the AclStatus parameter is set to on. |
AclStatus | String | No | off |
Specifies whether to enable the access control feature. Valid values: on and off. Default value: off. |
Description | String | No | Listener description |
The description of the listener. It must be 1 to 80 characters in length and can contain letters, digits, hyphens (-), forward slashes (/), periods (.), and underscores (_). Chinese characters are supported. |
ListenerForward | String | No | off |
Specifies whether to enable the HTTP-to-HTTPS redirection. Valid values: on and off. |
ForwardPort | Integer | No | 443 |
The listening port that is used to redirect HTTP requests to HTTPS. |
IdleTimeout | Integer | No | 3 |
The timeout period of an idle connection. Unit: seconds. Valid values: 1 to 60. Default value: 15. If no request is received during the specified timeout period, the SLB instance closes the connection. When another request is received, the SLB instance establishes a new connection. |
RequestTimeout | Integer | No | 6 |
The timeout period of a request. Unit: seconds. Valid values: 1 to 180. Default value: 60. If no response is received from the backend server within the specified timeout period,
SLB sends an |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | CEF72CEB-54B6-4AE8-B225-F876FF7BA984 |
The ID of the request. |
Examples
Sample request
http(s)://[Endpoint]/? Action=CreateLoadBalancerHTTPListener
&HealthCheck=off
&ListenerPort=80
&LoadBalancerId=lb-bp1c9vixxjh92q83tw*****
&StickySession=off
&BackendServerPort=80
&<Common request parameters>
Sample success responses
XML
format
<CreateLoadBalancerHTTPListenerResponse>
<RequestId>1FF504CB-BFFF-4508-A51A-58A416604FC8</RequestId>
</CreateLoadBalancerHTTPListenerResponse>
JSON
format
{
"RequestId": "1FF504CB-BFFF-4508-A51A-58A416604FC8"
}
Error codes
For a list of error codes, visit the API Error Center.