Updated on 2026-11-05 GMT+08:00

Adding an HTTP Listener

Scenarios

You can add an HTTP listener if content identification is required. HTTP is a great fit for workloads such as web applications and mobile mini-games.

Constraints

If the listener protocol is HTTP, the backend protocol is HTTP by default and cannot be changed.

Procedure

  1. Go to the load balancer list page.
  2. On the displayed page, locate the load balancer and click its name.
  3. Under Listeners, click Add Listener. Configure the parameters based on Table 1.
    Table 1 Parameters for configuring an HTTP listener

    Parameter

    Description

    Frontend Protocol

    Specifies the protocol that will be used by the load balancer to receive requests from clients.

    Select HTTP.

    Listening Port

    Specifies the port that will be used by the load balancer to receive requests from clients.

    The port number ranges from 1 to 65535.

    Name (Optional)

    Specifies the listener name.

    Redirect to another listener

    Specifies the HTTPS listener to which HTTP requests are redirected to encrypt the communication and improve service security.

    For example, if you configure an HTTP redirection, HTTP access to a web page will be redirected to the HTTPS listener you select and handled by the backend servers associated with the HTTPS listener. As a result, the clients access the web page over HTTPS. Note that the configurations for the HTTP listener will not be applied. Requests will be forwarded to backend servers by the HTTPS listener.

    Transfer Client IP Address

    Transfer Client IP Address is enabled by default for HTTP listeners.

    When you use an HTTP listener to forward requests, you can use the X-Forwarded-For header to transfer client IP addresses. The first IP address recorded in the X-Forwarded-For header is the client IP address.

    For details, see Transfer Client IP Address.

    Access Control

    Specifies how access to the listener is controlled. For details, see What Is Access Control?

    All IP addresses is selected for access control by default.

    You can select Whitelist or Blacklist and choose an IP address group.
    • Whitelist: Only IP addresses in the whitelist can access the listener. Requests from the IP addresses or IP address ranges specified in the IP address group will be forwarded by the listener.

      Access control policies only take effect for new connections, but not for existing ones. If a whitelist is configured for a listener but IP addresses that are not in the whitelist can access the backend server associated with the listener, it may be caused by a persistent connection between the client and the backend server. To deny IP addresses that are not in the whitelist from accessing the listener, the persistent connection between the client and the backend server needs to be disconnected.

    • Blacklist: IP addresses in the blacklist are not allowed to access the listener. Requests from the IP addresses or IP address ranges specified in the IP address group will not be forwarded by the listener.

    More (Optional)

    Idle Timeout (s)

    Specifies the maximum duration during which no data is transferred between the load balancer and a client. If no data is transmitted during this period, the load balancer closes the connection and establishes a new one when the next request is received.

    The idle timeout duration ranges from 0 to 4000.

    Request Timeout (s)

    Specifies how long the load balancer waits for a client request. It includes:
    • The timeout duration for the load balancer to read the request header from the client. If the client does not send a complete request header within this duration, the request is interrupted.
    • The maximum interval between two consecutive requests received by the load balancer.

    The request timeout duration ranges from 1 to 300.

    Response Timeout (s)

    Specifies how long the load balancer waits for a response from a backend server. If the backend server does not respond within the configured timeout, the load balancer retries the request on another backend server. If no backend server responds, the load balancer stops waiting and returns the HTTP 504 error code.

    The response timeout duration ranges from 1 to 300.

    NOTE:

    If you have enabled sticky sessions and the backend server does not respond within the response timeout duration, the load balancer returns 504 Gateway Timeout to the clients.

    Tag

    Adds tags to the listener. Each tag is a key-value pair, and the tag key is unique.

    Description

    Provides supplementary information about the listener.

    You can enter a maximum of 255 characters.

  4. Click Next: Configure Request Routing Policy.
    1. You are advised to select an existing backend server group. To create a backend server group, refer to Creating a Backend Server Group.

      To select a shared backend server group, you can only select a server group that is associated with the current load balancer, uses the same protocol as the listener, and is not associated with any listener or forwarding rule.

    2. You can also click Create new to create a backend server group.

      The new backend server group will be automatically associated with the current shared load balancer and listener and cannot be associated with other load balancers or listeners.

      1. Configure the backend server group based on Table 2.
      2. Click Next: Add Backend Server. Add backend servers and configure a health check for the backend server group.

        For details about how to add backend servers, see Backend Server Overview. For the parameters required for configuring a health check, see Table 3.

  5. Click Next: Confirm.
  6. Confirm the configurations and click Submit.