tencent cloud


Configuring HTTP Listener

Last updated: 2022-01-19 14:08:59

    You can create an HTTP listener to a CLB instance to forward HTTP requests from the client. HTTP is suitable for applications where request contents need to be identified, such as web applications and mobile apps.


    You need to create a CLB instance first.


    Step 1. Configure a listener

    1. Log in to the CLB console and click Instance Management on the left sidebar.
    2. Select a region in the top-left corner of the CLB instance list page and click Configure Listener in the Operation column on the right.
    3. Under HTTP/HTTPS Listener, click Create and configure the HTTP listener in the Create Listener pop-up window.
      a. Listener creation
      Configuration Item Description Example
      Name Listener name. test-http-80
      Listener Protocol and Ports
      • Listener protocol: HTTP is used in this example.
      • Listener port: a port used to receive requests and forward them to the real server. Port range: 1-65535. Ports 843, 1020, 1433, 1434, 3306, 3389, 6006, 20000, 36000, 42222, 48369, 56000, and 65010 are system reserved ports and cannot be opened.
      • The listener port must be unique in the same CLB instance.
      Enable Persistent Connection Once this feature is enabled, persistent connections will be used between CLB and real server, and CLB will no longer pass through the source IP, which can be obtained from XFF. To ensure normal forwarding, enable the "Allow by default" feature in the CLB security group or allow `` in the CVM security group. Enabled
      b. Forwarding rule creation
      Forwarding Rule Configuration Description Example
      Domain name Forwarding domain name:
      • Length: 1 - 80 characters.
      • Underscores (_) cannot be the first character.
      • Exact and wildcard domain names are supported.
      • Regex is supported.
      • For detailed configuration rules, see Layer-7 Domain Name Forwarding and URL Rules.
      Default Domain Name If all domain names of the listener are not matched, the system will direct requests to the default domain name, making default access controllable. Each listener can be configured with one default domain name only. Enabled by default.
      URL Path Forwarding URL path: | /index | | Balancing method | For HTTP listeners, CLB supports three scheduling algorithms: weighted round robin (WRR), weighted least connections (WLC), and IP hash.
      • WRR: requests are sequentially delivered to different real servers according to their weights. Scheduling is done based on the **number of new connections**, where servers with higher weights will undergo more polls (i.e., a higher probability), while servers with the same weight process the same number of connections.
      • WLC: loads of servers are estimated according to the number of active connections to the servers. Scheduling is done based on server loads and weights. If their weights are the same, servers with fewer active connections will undergo more polls (i.e., a higher probability).
      • IP hash: hash keys are used to locate the corresponding servers in the static hash table based on the source IPs of requests. If a server is available and not overloaded, requests will be delivered to it; otherwise, a null value will be returned.
      Getting Client IP Enabled by default. Enabled
      Gzip Compression Enabled by default. Enabled
      c. Health check
      For more information, see Health Check Configuration.
      d. Session persistence
      Session Persistence Configuration Description Example
      Session Persistence Switch
      • After session persistence is enabled, CLB listener will distribute access requests from the same client to the same real server.
      • TCP session persistence is implemented based on client IP address. The access requests from the same IP address are forwarded to the same real server.
      • Session persistence can be enabled for WRR scheduling but not WLC scheduling.
      Session Persistence Duration
      • If there is no new request within the connection beyond the session persistence duration, session persistence will be disabled automatically.
      • Value range: 30-3600s.

    Step 2. Bind a real server

    1. On the Listener Management page, select the created listener HTTP:80. Click + on the left to expand the domain names and URL paths, select the desired URL path, and view the real servers bound to the path on the right of the listener.
    2. Click Bind, select the target real server, configure the server port and weight in the pop-up window.

      Default port: enter the Default Port first and then select the CVM instance. The port of every CVM instance is the default port.

    Step 3. Configure a security group (optional)

    You can configure a CLB security group to isolate public network traffic. For more information, see CLB Security Group Configuration.

    Step 4. Modify and delete a listener (optional)

    If you need to modify or delete a created listener, click the listener on the Listener Management page and click for modification or for deletion.

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support