tencent cloud

Feedback

Configuring an HTTP Listener

Last updated: 2024-10-10 15:38:26
    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.

    Prerequisites

    You have created a CLB instance. For more information, see Creating CLB Instances.

    Directions

    Step 1. Configure a listener

    1. Log in to the CLB console and click Instance management in the left sidebar.
    2. Select your region in the top-left corner of the CLB instance list and click Configure listener in the Operation column of the target instance.
    
    
    3. Under HTTP/HTTPS listener, click Create and configure the HTTP listener in the pop-up window.
    3.1 Create a listener
    Parameter
    Description
    Example
    Name
    Listener name.
    test-http-80
    Listening protocol and port
    Listening protocol: In this case, select HTTP.
    Listening port: The port used to receive requests and forward them to a real server. Port range: 1-65535.
    A listening port must be unique in the same CLB instance.
    HTTP:80
    Enable persistent connection
    Once this feature is enabled, persistent connections will be used between a CLB instance and real servers, and the CLB instance will no longer pass through the source IP address that can be obtained from XFF. To ensure normal forwarding, enable the "Allow Traffic by Default" feature in the CLB security group or allow 100.127.0.0/16 in the CVM security group.
    Note:
    Once this feature is enabled, the number of the connections between a CLB instance and real servers will fluctuate in the range of [QPS,QPS*60], subject to the connection reuse rate. If there is a limit on the maximum number of connections, we recommend you be cautious when enabling this feature. This feature is currently in beta test. To try it out, submit a ticket.
    The IP range 100.64.0.0/10 is already allowed as the health check source IP. You don't need to allow IPs within this range again.
    Disabled
    3.2 Create a forwarding rule
    Parameter
    Description
    Example
    Domain name
    Forwarding domain name:
    Length: 1-80 characters.
    It cannot begin with underscores (_).
    Exact and wildcard domain names are supported.
    Regular expressions are supported.
    www.example.com
    Default Domain
    If all domain names of a listener are not matched, the system distributes requests to the default domain name, making default access controllable. Each listener can be configured with only one default domain name.
    Enabled by default
    URL
    Forwarding URL:
    Length: 1-200 characters.
    Regular expressions are supported.
    /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 distributed to real servers in sequence based on their weights. This algorithm performs scheduling based on the number of new connections. Servers with higher weights are more likely to be scheduled and servers with the same weight process the same number of connections.
    WLC: Loads of servers are estimated based on the number of active connections to the servers. This algorithm performs scheduling based on server loads and weights. For servers with the same weight, those have less loads are more likely to be scheduled.
    IP Hash: This algorithm uses a request source IP address as the Hash key to locate the corresponding server in the static hash table. If a server is available and not overloaded, requests will be distributed to it; otherwise, a null value will be returned.
    WRR
    Get client IP
    Enabled by default
    Enabled
    Gzip compression
    Enabled by default
    Enabled
    3.3 Configure health check
    For more information, see HTTP Listener.
    3.4 Configure session persistence
    Parameter
    Description
    Example
    Session persistence
    After session persistence is enabled, a CLB listener will distribute access requests from the same client to the same real server.
    TCP session persistence is implemented based on the 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.
    Enabled
    Hold Time
    Session persistence is terminated if there are no new requests in the connection within the specified duration.
    Value range: 30-3600 seconds
    30 seconds

    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, and configure the server port and weight in the pop-up window.
    
    Note:
    If you set Default port first and then select real servers, the port of every real server 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 Configuring a CLB Security Group.

    Step 4. Modify or 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