This topic describes how to add an HTTP listener to an Application Load Balancer (ALB) instance. An HTTP listener is a process that checks for connection requests. You can configure listeners when you create an ALB instance or add listeners to an ALB instance after the ALB instance is created. HTTP is intended for applications that identify data content, such as web applications and mobile games. You can add HTTP listeners to forward HTTP requests.


  • An ALB instance is created. For more information, see Create an ALB instance.
  • The forwarding actions in the default forwarding rule are configured and the destination backend servers are specified. For more information, see Manage server groups.

Create a listener

  1. Log on to the SLB console.
  2. In the left-side navigation pane, choose ALB > Instances.
  3. On the Instances page, find the ALB instance that you want to manage and click Create Listener in the Actions column.
  4. On the Configure Listener wizard page in the Configure Server Load Balancer wizard, set the following parameters.
    Parameter Description
    Listener Protocol Select a protocol for the listener.

    HTTP is selected in this example.

    Listener Port Enter the port on which the ALB instance listens. The ALB instance listens on the port and forwards requests to backend servers. Valid values: 1 to 65535. In most cases, port 80 is used for HTTP and port 443 is used for HTTPS.
    Note The ports on which an ALB instance listens must be unique.

    The port number is set to 80 in this example.

    Listener Name Enter a name for the listener. The name must be 2 to 256 characters in length. The name can contain only Chinese characters and the characters in the following string: /^([^\x00-\xff]|[\w.,;/@-]){2,256}$/.
    Advanced Settings
    Idle Connection Timeout Period Specify the timeout period of idle connections. Unit: seconds. Valid values: 1 to 60.
    If no request is received within the specified timeout period, ALB closes the connection. ALB recreates the connection when a new connection request is received.
    Note This feature is unavailable for HTTP/2 requests.
    Connection Request Timeout Period Specify the request timeout period. Unit: seconds. Valid values: 1 to 180.

    If no response is received from the backend server within the request timeout period, SLB returns an HTTP 504 error to the client.

    Gzip Compression Specify whether to enable Gzip compression for specific file types.

    Gzip supports the following file types: text/xml, text/plain, text/css, application/javascript, application/x-javascript, application/rss+xml, application/atom+xml, and application/xml.

    Add HTTP Header Fields You can add the following HTTP header fields:
    • X-Forwarded-For: Add the header field to obtain the real IP address of the client.
    • SLB-ID: Add the header field to obtain the ID of the ALB instance.
    • X-Forwarded-Proto: Add the header field to obtain the listener protocol of the ALB instance.
    • X-Forwarded-Port: Add the header field to obtain the ports on which the ALB instance listens.
    • X-Forwarded-Client-Port: Add the header field to obtain the port over which a client communicates with the ALB instance.
  5. Click Next.
  6. On the Select Server Group wizard page, select a server group to check the details of the backend servers that are added to the server group.
  7. Click Next.
  8. On the Configuration Review wizard page, confirm the configuration and then click Submit.