This topic describes how to add an HTTP listener to an Application Load Balancer (ALB) instance. A listener is used to check for connection requests. After you create an ALB instance, you can add listeners to the ALB instance based on your business requirements. HTTP is suitable for applications that need to identify data content, such as web applications and mobile games. You can add an HTTP listener to forward HTTP requests.

Prerequisites

Create a listener

  1. Log on to the ALB console.
  2. In the top navigation bar, select the region of the ALB instance.
  3. Use one of the following methods to open the listener configuration wizard:
    • On the Instances page, find the ALB instance that you want to manage and click Create Listener in the Actions column.
    • On the Instances page, click the ID of the ALB instance that you want to manage. On the Listener tab, click Create Listener.
  4. In the Configure Listener step, set the following parameters and click Next.
    Parameter Description
    Listener Protocol Select a listening protocol.

    HTTP is selected in this example.

    Listener Port Specify the port on which the ALB instance listens. The ALB instance listens for requests on the specified port and then forwards the 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.

    In this example, the listening port is set to 80.

    Listener Name

    Enter a name for the listener. The name must be 2 to 256 characters in length and can contain letters, digits, periods (.), underscores (_), hyphens (-), commas (,), semicolons (;), forward slashes (/), and at signs (@).

    Advanced Settings Click Modify to configure the advanced settings.
    Idle Connection Timeout Period Specify a timeout period for idle connections. Unit: seconds. Valid values: 1 to 60.
    If no request is received within the specified timeout period, ALB closes the connection. When another request is received, ALB establishes a new connection.
    Note This feature is not available 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, ALB returns an HTTP 504 error code to the client.

    Compression If you enable compression, specific types of files are compressed. If you disable compression, no file is compressed.

    All file types support Brotli compression. File types that support Gzip compression: text/xml, text/plain, text/css, application/javascript, application/x-javascript, application/rss+xml, application/atom+xml, application/xml, and application/json.

    Add HTTP Header Fields Supported headers:
    • X-Forwarded-For: retrieves client IP addresses.
    • SLB-ID: retrieves the ID of the ALB instance.
    • X-Forwarded-Proto: retrieves the listening protocol.
    • X-Forwarded-Port: retrieves the listening port.
    • X-Forwarded-Client-srcport: retrieves the client port.
  5. On the Select Server Group wizard page, specify Server Type and select a server group based on the specified Server Type, confirm the backend servers, and then click Next.
  6. On the Confirm wizard page, confirm the configurations and click Submit.