Updated on 2025-09-25 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

  • HTTP listeners can only be associated with HTTP backend server groups.
  • If you only select the network load balancing type for your dedicated load balancer, you cannot add HTTP listeners to this load balancer.

Procedure

  1. Go to the load balancer list page.
  2. On the displayed page, locate the load balancer and click its name.
  3. On the Listeners tab, 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 requests to access 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.

    After the redirection is configured for an HTTP listener, the backend server will return 301 Moved Permanently to the clients.

    Transfer Client IP Address

    This option is enabled for dedicated load balancers by default.

    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 Using Dedicated Load Balancers to Transfer Client IP Address.

    Advanced Forwarding

    Specifies whether to enable advanced forwarding. This option allows you to configure advanced forwarding policies to forward requests to different backend server groups.

    For more information, see Advanced Forwarding.

    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 CIDR blocks specified in the IP address group will be forwarded by the listener.
    • Blacklist: IP addresses in the blacklist are not allowed to access the listener. Requests from the IP addresses or CIDR blocks specified in the IP address group will not be forwarded by the listener.

    More (Optional)

    Idle Timeout (s)

    Specifies the length of time for a connection to keep alive, in seconds. If no request is received within this period, the load balancer closes the connection and establishes a new one with the client when the next request arrives.

    The idle timeout duration ranges from 0 to 4000.

    Request Timeout (s)

    Specifies the length of time (in seconds) that a load balancer is willing to wait for a client request to finish. The load balancer terminates the connection if a request takes too long to complete.

    The request timeout duration ranges from 1 to 300.

    Response Timeout (s)

    Specifies the length of time (in seconds) after which the load balancer sends a 504 Gateway Timeout error to the client if the load balancer receives no response from the backend server after routing a request to the backend server and receives no response after attempting to route the same request to other backend servers.

    If sticky session is enabled and the load balancer receives no response from the backend server within the response timeout duration, the load balancer returns a 504 Gateway Timeout error to the client directly.

    The response timeout duration ranges from 1 to 300.

    Description

    Provides supplementary information about the listener.

    You can enter a maximum of 255 characters.

    HTTP Headers

    Select HTTP headers as needed.

    • Transferring client information
      • Rewrite X-Forwarded-For-Port to transfer the client port.
      • Rewrite X-Forwarded-Host to transfer the client domain name.
    • Transferring load balancer information
      • Rewrite X-Forwarded-ELB-IP to transfer the load balancer EIP.
      • Rewrite X-Forwarded-Port to transfer the listener port.

    For details, see HTTP Headers.

  4. Click Next: Configure Request Routing Policy.
    1. You are advised to select an existing backend server group.
    2. You can also select Create new to create a backend server group.
      1. Configure the backend server group based on Table 3.
      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 4.

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