After you create a Global Accelerator (GA) instance, you must configure listeners for the GA instance. A listener listens for connection requests and then distributes the requests to endpoints based on the forwarding rules that are defined by a specified scheduling algorithm.

Prerequisites

Add a TCP or UDP listener

  1. Configure the listener and protocol.
    1. Log on to the GA console.
    2. On the Instances page, find the GA instance that you want to manage and click Configure Listeners in the Actions column.
    3. On the Listener tab, click Add Listener.
      Note If this is the first time that you add a listener, or the specified GA instance is not configured with a listener, skip this step.
    4. On the Configure Listener & Protocol wizard page, specify the following listener information and click Next.
      Parameter Description
      Listener Name Enter a name for the listener.

      The name must be 2 to 128 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). The name must start with a letter.

      Protocol Select a protocol for the listener. Valid values:
      • TCP
        • A connection-oriented protocol that provides high reliability. A logical connection must be established before data can be transmitted.
        • Session persistence is based on source IP addresses.
        • Source IP addresses are visible at the network layer.
        • Data is transmitted at a slow rate.
      • UDP
        • A connectionless and unreliable protocol. Three-way handshakes are not required before UDP packets are transmitted. UDP does not provide error recovery or data retransmission.
        • Data is transmitted at a high rate.
      Port Number Specify the listener port. The listener port is used to receive requests and forward requests to endpoints. Valid values: 1 to 65499.

      You can specify at most 30 listener ports for each listener. Separate multiple listener ports with commas (,). Example: 80,90,8080.

      If you want to specify a port range, you can use a tilde (~). Example: 80~85.

      Note
      • If you add listeners that use the same protocol to a GA instance, you must configure different ports for the listeners.
      • You can specify more than 300 consecutive listener ports for a listener in specific regions. For more information, see Advanced listeners.
      Client Affinity Specify whether to enable client affinity.
      • If you select Source IP Address from the drop-down list, client affinity is enabled. After client affinity is enabled, requests from a specific client IP address are forwarded to the same endpoint.
      • If you select Disable from the drop-down list, client affinity is disabled. After client affinity is disabled, requests from a specific client IP address may be forwarded to different endpoints.
  2. Configure endpoints.
    Each listener is associated with an endpoint group. You can associate an endpoint group with a listener by specifying the regions to which you want to distribute network traffic. After you associate an endpoint group with a listener, traffic is distributed to the optimal endpoint in the associated endpoint group.

    On the Configure Endpoint Group wizard page, set the following parameters and click Next.

    For more information about endpoint groups and endpoints, see Overview.

    Parameter Description
    Endpoint Group Name Enter a name for the endpoint group.

    The name must be 2 to 128 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). The name must start with a letter.

    Region Select the region where you want to deploy the endpoint group.
    Traffic Distribution Ratio Set the traffic distribution ratio for the endpoint group. Unit: %.

    Valid values: 0 to 100.

    Note You can set Traffic Distribution Ratio only when you create an endpoint group for a TCP or UDP listener.
    Backend Service Select the region where you want to deploy backend servers.
    • Alibaba Cloud: Backend servers are deployed on Alibaba Cloud.
    • Off Alibaba Cloud: Backend servers are not deployed on Alibaba Cloud.
    Preserve Client IP Specify whether to preserve client IP addresses.

    After you enable this feature, backend servers can retrieve client IP addresses. For more information, see Preserve client IP addresses.

    Endpoint Endpoints are destinations of client requests. To add an endpoint, specify the following parameters:
    • Backend Service Type: If your backend service is deployed on Alibaba Cloud, you can select Alibaba Cloud Public IP Address, ECS, CLB, ALB, or OSS. If your backend service is not deployed on Alibaba Cloud, you can select Custom IP Address or Custom Domain Name.
      Note
      • You can specify ECS, CLB, and ALB instances as endpoints only if your Alibaba Cloud account is included in the whitelist. If you want to specify ECS, CLB, or ALB instances as endpoints for your GA instances, submit a ticket to upgrade the GA instances.
      • The IP addresses of endpoint groups associated with each GA instance must be globally unique and not conflict with those of other GA instances.
      • If no service-linked role exists when you specify ECS instances, CLB instances, ALB instances, or OSS buckets as endpoints, the system automatically creates the corresponding service-linked role. For more information, see AliyunServiceRoleForGaVpcEndpoint, AliyunServiceRoleForGaAlb, and AliyunServiceRoleForGaOss.
    • Backend Service: Enter the IP address, domain name, or instance ID of the backend server.
    • Weight: Set a weight for the endpoint. Valid values: 0 to 255. GA distributes network traffic to endpoints based on their weights.
      Notice If the weight of an endpoint is set to 0, GA stops distributing network traffic to the endpoint. Proceed with caution.

    You can click + Add Endpoint to add more endpoints. You can create at most four endpoints in each endpoint group. If you want to add more endpoints, go to the Quota Management page and increase the quota. For more information, see Manage quotas.

  3. Confirm the configurations.
    On the Confirm wizard page, confirm the configurations of the listener and endpoint, and then click Submit.

    If you want to modify a specific setting, click Modify in the corresponding section. Then, you are redirected to the configuration page.

    Note If this is the first time you add a listener, the listener takes effect after 3 minutes. If you modify the configurations of a listener, the new configurations take effect after 1 minute.

Add an HTTP or HTTPS listener

  1. Configure the listener and protocol.
    1. Log on to the GA console.
    2. On the Instances page, find the GA instance that you want to manage and click Configure Listeners in the Actions column.
    3. On the Listener tab, click Add Listener.
      Note If this is the first time that you add a listener, or the specified GA instance is not configured with a listener, skip this step.
    4. On the Configure Listener & Protocol wizard page, set the following parameters and click Next.
      Parameter Description
      Listener Name Enter a name for the listener.

      The name must be 2 to 128 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). The name must start with a letter.

      Protocol Select a network transmission protocol for the listener. Valid values:
      • HTTPS: HTTPS has the following features:
        • A connection-oriented protocol that provides high reliability. A logical connection must be established before data can be transmitted.
        • You can bind SSL certificates to servers. This ensures the high reliability of data.
        • Data transmission is encrypted.
      • HTTP: HTTP has the following features:
        • A connection-oriented protocol that provides high reliability. A logical connection must be established before data can be transmitted.
        • Data is transmitted at a high rate.
        • Data transmission is not encrypted.
      Port Number Specify the listener port. The listener port is used to receive requests and forward requests to endpoints. Valid values: 1 to 65499.

      You can configure only one listener port for each HTTP or HTTPS listener.

      Client Affinity Specify whether to enable client affinity.
      • If you select Source IP Address from the drop-down list, client affinity is enabled. After client affinity is enabled, requests from a specific client IP address are forwarded to the same endpoint.
      • If you select Disable from the drop-down list, client affinity is disabled. After client affinity is disabled, requests from a specific client IP address may be forwarded to different endpoints.
      Advanced Settings Click Modify and select Add HTTP Header Fields.
      • Add the GA-ID header to retrieve the ID of the GA instance.
      • Use the GA-AP header to retrieve the acceleration region of the GA instance.
      • Use the GA-X-Forwarded-Proto header to retrieve the listener protocol of the GA instance.
      • Use the GA-X-Forwarded-Port header to retrieve the listener port of the GA instance.
      • Use the X-Real-IP header to retrieve client IP addresses.
  2. Optional. Configure the SSL certificate.
    You are required to configure an SSL certificate only when you add an HTTPS listener. SSL certificates ensure that data transmission over GA is encrypted.
    1. On the Configure SSL Certificate page, select the SSL certificate that you have purchased.
    2. Click Modify to the right of Advanced Settings and select a TLS security policy from the TLS Security Policies drop-down list.
      For more information about TLS security policies, see TLS security policies.
    3. Click Next.
  3. Configure endpoints.
    Each listener is associated with an endpoint group. You can associate an endpoint group with a listener by specifying the regions to which you want to distribute network traffic. After you associate an endpoint group with a listener, traffic is distributed to the optimal endpoint in the associated endpoint group.

    On the Configure Endpoint Group wizard page, set the following parameters and click Next.

    For more information about endpoint groups and endpoints, see Overview.

    Parameter Description
    Endpoint Group Name Enter a name for the endpoint group.

    The name must be 2 to 128 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). The name must start with a letter.

    Region Select the region where you want to deploy the endpoint group.
    Backend Service Select the region where you want to deploy backend servers.
    • Alibaba Cloud: Backend servers are deployed on Alibaba Cloud.
    • Off Alibaba Cloud: Backend servers are not deployed on Alibaba Cloud.
    Preserve Client IP Specify whether to preserve client IP addresses.

    By default, client IP address preservation is enabled for HTTP and HTTPS listeners. GA preserves the IP address of a client in the X-Forwarded-For HTTP header. For more information, see Preserve client IP addresses.

    Endpoint Endpoints are destinations of client requests. To add an endpoint, specify the following parameters:
    • Backend Service Type: If your backend service is deployed on Alibaba Cloud, you can select Alibaba Cloud Public IP Address, ECS, CLB, ALB, or OSS. If your backend service is not deployed on Alibaba Cloud, you can select Custom IP Address or Custom Domain Name.
      Note
      • You can specify ECS, CLB, and ALB instances as endpoints only if your Alibaba Cloud account is included in the whitelist. If you want to specify ECS, CLB, or ALB instances as endpoints for your GA instances, submit a ticket to upgrade the GA instances.
      • The IP addresses of endpoint groups associated with each GA instance must be globally unique and not conflict with those of other GA instances.
      • If no service-linked role exists when you specify ECS instances, CLB instances, ALB instances, or OSS buckets as endpoints, the system automatically creates the corresponding service-linked role. For more information, see AliyunServiceRoleForGaVpcEndpoint, AliyunServiceRoleForGaAlb, and AliyunServiceRoleForGaOss.
    • Backend Service: Enter the IP address, domain name, or instance ID of the backend server.
    • Weight: Set a weight for the endpoint. Valid values: 0 to 255. GA distributes network traffic to endpoints based on their weights.
      Notice If the weight of an endpoint is set to 0, GA stops distributing network traffic to the endpoint. Proceed with caution.

    You can click + Add Endpoint to add more endpoints. You can create at most four endpoints in each endpoint group.

    Backend Service Protocol Select the protocol that the backend server uses. Valid values:
    • HTTP: This is the default value.
    • HTTPS
    Note
    • If the listener protocol is HTTP, this parameter is set to HTTP by default and cannot be modified.
    • You can set Backend Service Protocol only when you configure an endpoint group for an HTTP or HTTPS listener.
    Port Mapping If the listener port and the port that the endpoint uses to provide services are not the same, you must add a mapping between the ports.
    • Listener Port: Enter the listener port.
    • Endpoint Port: Enter the port that the endpoint uses to provide services.

    If the listener port and the port that the endpoint uses to provide services are the same, you do not need to add the port mapping. GA automatically distributes client requests to the listener port of the endpoint.

    Note You can set Port Mapping only when you configure an endpoint group for an HTTP or HTTPS listener.
  4. Confirm the configurations.
    On the Confirm wizard page, confirm the configurations of the listener and endpoint, and then click Submit.

    If you want to modify a specific setting, click Modify in the corresponding section. Then, you are redirected to the configuration page.

    Note If this is the first time you add a listener, the listener takes effect after 3 minutes. If you modify the configurations of a listener, the new configurations take effect after 1 minute.
Note After you add an HTTP or HTTPS listener, you can configure a virtual endpoint group and a forwarding rule for the listener. Then, GA can simultaneously accelerate multiple domain names or paths to access your backend HTTP or HTTPS services. For more information, see Create and manage endpoint groups and Create and manage forwarding rules.

For more information, see Use one GA instance to accelerate multiple domain names over HTTPS.

What to do next

Operation Description
Modify a listener You can modify a listener to meet your business requirements. The configurations that you can modify include the basic settings, protocol, SSL certificate, and endpoint group of the listener.
  1. On the Listeners tab, find the listener that you want to modify and click Modify in the Actions column.
  2. On the Edit Listener page, modify the basic settings, protocol, SSL certificate, or endpoint group of the listener and then click Next.

    For more information about the basic settings, protocol, SSL certificate, and endpoint group of a listener, see Add a TCP or UDP listener or Add an HTTP or HTTPS listener.

Delete a listener You can delete a listener. After a listener is deleted, the endpoint group that is associated with the listener is also deleted.
  1. On the Listeners tab, find the listener that you want to delete and click Delete in the Actions column.
  2. In the Delete Listener message, click OK.

Related topics

  • CreateListener: You can call this API operation to create a listener for a GA instance.
  • UpdateListener: You can call this API operation to modify a specified listener of a GA instance.
  • DeleteListener: You can call this API operation to delete a specified listener of a GA instance.