HTTP Listener Introduction
You can add an HTTP listener to the CLB instance to forward HTTP protocol requests from clients. The HTTP protocol is suitable for applications that need to identify the content of the request, such as Web applications, App services, etc.
Configuring HTTP Listeners
Step 1: Open the listener management page
- Log in to the CLB control, and click LB Instance List in the left sidebar.
- On the CLB instance list page, click the target instance ID.
- On the instance details page, click the Listener Management tab.
Step 2: Configure the listener
In the HTTP/HTTPS listener module, click Create and configure the HTTP listener in the pop-up box.
1. Create a listener
| Parameter | Note |
|---|---|
| Name | The name of the listener. In this example, it can be customized as Listener1. |
| Listener Protocol Port | The listener's protocol and listening port. - The listening protocols include HTTP and HTTPS. In this example, HTTP is selected. - The listening port is used to receive requests and forward them to the backend server. The port range is 1 - 65535. - The listening ports in the same CLB instance cannot be repeated. |
| Default domain name |
You can choose to turn it on or off. - Enable: When the client request does not match any domain name of this listener, CLB will forward the request to the default domain name (Default Server). Each listener can only be configured with one default domain name. - If your layer-7 listener has been configured with a default domain name, client requests that do not match other rules will be forwarded to the default domain name. - If your layer-7 listener is not configured with a default domain name, client requests that do not match other rules will be forwarded to the first domain name loaded by the CLB. Since the loading order may be inconsistent with the console configuration order, it is not necessarily the first one configured by the console. - Disable: When the client request does not match any domain name of this listener, the request will not be forwarded. |

2. Create forwarding rules
| Basic configuration of forwarding rules | Note | Example |
|---|---|---|
| Domain name | Request a domain name. - Supports precise domain names, such as www.example,com . Supports wildcard domain names, such as *.example.com or www.example.*. In a single domain name * can only appear once.- The character sets supported by irregular domain names are as follows: az``0-9``.``-.- Regular expressions are supported. The character sets that are not supported in regular expressions are as follows: "``{``}``;``\ ``` ~`````Space.- The domain name length limit is 1 - 120. |
www.example.com |
| Default domain name | - When all domain names in the listener are not matched successfully, the system will direct the request to the default access domain name to make the default access controllable. - Only one default domain name can be configured for a listener. |
Enable |
| URL Path | Request path. - The default is /, must be preceded by /.The length limit is 1 - 120.- Non-regular URL path starts with /. The supported character sets are as follows: az``AZ``0-9``.``-``/``=``? .- Support regular expressions - Beginning with = indicates an exact match.- ^~ beginning means that the uri starts with a regular character string, not a regular match.- ~ beginning indicates a case-sensitive regular match.- ~* beginning of the regular expression indicates a case-insensitive match.- / means universal match; if there is no other match, any request will match- For regular URL, unsupported character sets are as follows: "``{``}``;``\ ``` ~`````Space. |
/index |
| Balance Mode | In the HTTP listener, CLB supports three scheduling algorithms: weighted round-robin (WRR), weighted least connections (WLC), and IP Hash. - Polling by Weight: Distributes requests to different servers in sequence based on the weights of backend servers. Schedule by the weighted round-robin algorithm, based on the number of new connections. The server with a higher weight is rounded more often (high probability), and servers with the same weight handle the same number of connections. - Min. Weighted Connections: Estimates the server load based on the number of active connections currently on the server. The weighted least connections are comprehensively scheduled based on the server load and weight. When the weight values are the same, the backend server with a smaller current number of connections has a higher probability of being rounded. - IP Hash: Based on the source IP address of the request, use the hash key to find the corresponding server from the statically allocated hash table. If the server is available and not overloaded, the request is sent to the server, otherwise it returns nothing. |
weighted round robin, |
| Obtain Client IP address | Enabled by default. | Enabled |
| Gzip Compression | Enabled by default. | Enabled |
Select the HTTP listener for which you need to create a forwarding rule, click + on the right side to create the rule, and the basic configuration is shown in the figure below.

3. Health check
| Health check configuration | Note | Example |
|---|---|---|
| Health Check | Enable or disable health check. In the HTTP listener, the CLB instance sends an HTTP request to the specified server port for health check. | Enable |
| Check Domain Name | Request domain - The request domain is set to the forwarding domain by default. - Supported character sets include: az``0-9``.``- , length limit is 1 - 120.- Regular expressions are not currently supported. - When the user fills in the domain name as a wildcard domain name, it is necessary to specify a fixed domain name (non-regular) as the health check domain name. |
Use the default value (that is, www.example.com). |
| Check Directory | Request path - The default is /, must be preceded by /.- Supported character sets include: az``0-9``.``- , length limit is 1 - 120.- Regular expressions are not currently supported. - It is recommended to specify a fixed URL path (static page) for health check. |
Use the default value (that is, /). |
| Detection interval | - The interval for the CLB health check. - Configurable range: 5 - 300 seconds, default value is 5 seconds. |
5s |
| Unhealthy Threshold | - If the health check results received for n consecutive times (n is the filled value) fail, it is identified as unhealthy and the console displays exceptional. - Configurable range: 2 - 10 times, with a default value of 3 times. |
3 times |
| Health threshold | - If the health check results received for n consecutive times (n is the filled value) are successful, it is identified as healthy and the console displays healthy. - Configurable range: 2 - 10 times, with a default value of 3 times. |
3 times |
| HTTP Request Method | HTTP request method for health check, optional: GET or HEAD, the default is GET. - If the HEAD method is used, the server only returns the HTTP header information, which can reduce backend overhead and improve request efficiency. The corresponding backend service must support HEAD. - If the GET method is used, the backend service only needs to support GET. |
GET |
| HTTP status code detection | When the status code is the selected status code, the backend server is considered alive, that is, the health check is normal. Optional: http_1xx, http_2xx, http_3xx, http_4xx, http_5xx. | Multiple selection: http_1xx, http_2xx, http_3xx, http_4xx |
The specific configuration of health check is shown in the figure below.

4. Session Affinity
| Session persistence configuration | Note | Example |
|---|---|---|
| Session Affinity Status | Enable or disable session persistence. - After session persistence is enabled, the CLB listener will distribute access requests from the same client to the same backend server. - The HTTP protocol is based on cookie session persistence, and the CLB embeds cookies into the client. - Weighted round-robin scheduling supports session persistence, while weighted least connections and IP Hash scheduling do not support session persistence. |
Enable |
| Session Affinity Time | Session persistence time - When the persistence time is exceeded and there is no new request in the connection, the session will be automatically disconnected. - Configurable range 30 - 3,600 seconds. |
30s |
The specific configuration of session persistence is shown in the following figure.

Step 3: Bind the backend CVM
- On the Listener Management page, click the created listener, such as
HTTP:80listener above. Click the triangle icon on the left to expand the domain name and URL path, select a specific URL path, and you can view the backend services bound to the path on the right side of the listener.

2. Click Bind, select the backend server to be bound in the pop-up box, and configure the service port and weight.
- Add port feature: In the Selected CVM box on the right, click Add Port to add multiple ports to the same CVM.
- Default port feature: Fill in Default Port first, then select the CVM. The port of each CVM is the default port.

Step 4: Modify/delete the listener
If you need to modify or delete a created listener, on the Listener Management page, click the created listener/domain name/URL path and select Modify or Delete to complete the operation.