Updated on 2024-06-20 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. Log in to the management console.
  2. In the upper left corner of the page, click and select the desired region and project.
  3. Click in the upper left corner to display Service List and choose Networking > Elastic Load Balance.
  4. On the Load Balancers page, locate the load balancer and click its name.
  5. Under Listeners, click Add Listener. Configure the parameters based on Table 1.
    Table 1 Parameters for configuring an HTTP listener

    Parameter

    Description

    Name

    Specifies the listener name.

    Frontend Protocol

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

    Select HTTP.

    Frontend 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.

    Redirect

    Specifies whether to enable redirection.

    If you have both HTTPS and HTTP listeners, you can use this function to redirect the requests from the HTTP listener to the HTTPS listener to ensure security.

    If you create a redirect for an HTTP listener, the backend server will return HTTP 301 Move Permanently to the clients.

    Redirected To

    Select the HTTPS listener to which requests are redirected.

    Access Control

    Specifies how access to the listener is controlled. For details, see What Is Access Control? The following options are available:

    • All IP addresses
    • Blacklist
    • Whitelist

    IP Address Group

    Specifies the IP address group associated with a whitelist or blacklist. If there is no IP address group, create one first. For more information, see IP Address Group.

    Transfer Client IP Address

    Specifies whether to transmit IP addresses of the clients to backend servers.

    Advanced Settings

    Transfer Load Balancer EIP

    Specifies whether to store the EIP bound to the load balancer in the X-Forwarded-ELB-IP header field and pass this field to backend servers.

    Enable this option if you want to transparently transmit the EIP of the load balancer to backend servers.

    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 that a load balancer is willing to wait for a client request to complete. 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.

    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.

    Description

    Provides supplementary information about the listener.

    You can enter a maximum of 255 characters.

  6. Click Next: Configure Request Routing Policy.
    1. You are advised to select an existing backend server group.
    2. You can also click Create new to create a backend server group.
      1. Configure the backend server group based on Table 2.
      2. Click Next: Add Backend Server. Add backend servers and configure 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.

  7. Click Next: Confirm.
  8. Confirm the configurations and click Submit.