All Products
Search
Document Center

Server Load Balancer:Add an HTTP listener

Last Updated:Aug 29, 2023

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. 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 where the ALB instance resides.

  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

    Listening Protocol

    Select a listener 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 listener 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 advanced settings.

    Idle Connection Timeout Period

    Specify the timeout period of an idle connection.

    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 unavailable for HTTP/2 requests.

    Connection Request Timeout Period

    Specify the timeout period of a request.

    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, files of specific types are compressed. If you disable compression, no file is compressed.

    Brotli supports all 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, application/xml, and application/json.

    Add HTTP Header Fields

    Select the HTTP headers that you want to add. Valid values:

    • Add X-Forwarded-For to Retrieve Client IP: obtains client IP addresses.

    • Add SLB-ID to Retrieve ALB ID: obtains the ID of the ALB instance.

    • Add X-Forwarded-Proto to Retrieve Listening Protocol: obtains the listener protocol.

    • Add X-Forwarded-Port to Retrieve Listening Port: obtains the listener port.

    • Add X-Forwarded-Client-srcport to Retrieve Client Port: obtains the client port.

  5. In the Select Server Group step, select Server Type, select a server group from the drop-down list next to Server Type, view the backend servers, and then click Next.

  6. In the Confirm step, confirm the configurations and click Submit.