All Products
Search
Document Center

Serverless App Engine:Configure gateway routing for an application by using a CLB instance

Last Updated:Nov 05, 2024

After you host an application to Serverless App Engine (SAE), you can configure gateway routing for the application to distribute your requests to other services or applications. This topic describes how to configure gateway routing for an application by using a Classic Load Balancer (CLB) instance.

Prerequisites

  • An application is hosted to SAE. For more information, see Deploy a Java application to SAE 1.0.

  • A CLB instance is created. For more information, see Create and manage a CLB instance.

  • You are familiar with the related limits. For more information, see Limits.

  • The application for which you want to configure gateway routing and the application that receives requests at the backend reside in the same namespace.

Background information

Server Load Balancer (SLB) is a service that distributes network traffic across groups of backend servers to increase the throughput of applications. You can use SLB to prevent service disruptions that are caused by single points of failure (SPOFs) and improve the availability of applications. For more information, see What is SLB?.

For information about how to configure gateway routing for application by using an Application Load Balancer (ALB) instance, see Configure gateway routing for an application by using an ALB instance.

Scenarios

The gateway routing feature is suitable for the following scenarios:

  • A single application or multiple applications need to forward traffic by using the same domain name in different paths.

  • A single application or multiple applications need to forward traffic to different domain names that are resolved to the same IP address.

After you configure gateway routing, you can use a URL in the <Domain name>:<Port number>/Path format to access the related backend services or applications.

Limits

Applicable to only microservices applications and the applications of the Always Allocate Fixed CPU Cores mode.

Create a gateway route

  1. Log on to the SAE console.

  2. In the left-side navigation pane, click Applications. In the top navigation bar, select a region. Then, click the name of an application.

  3. In the Gateway Routing Settings section of the Basic Information page, click Add Forwarding Policy. On the Gateway Routing page, click Create.

    You can also click Gateway Routing in the left-side navigation pane of the details page of a namespace to open the Gateway Routing page.

  4. In the Create Routing Rule panel, configure the parameters.

    1. In the Configure Gateway Ingress step, configure the parameters and click Next. The following table describes the parameters.

      Parameter

      Description

      Name

      The name of the routing rule.

      Network Type

      The network type of the requests that you want to forward.

      • Internet: You are charged for the actual amount of traffic that is forwarded by using Internet gateways.

      • Private: You are not charged for the traffic that is forwarded by using private gateways. Traffic can be forwarded only in the current virtual private cloud (VPC).

      Gateway Type

      Select CLB and select a CLB instance from the CLB Instance (formerly known as Server Load Balancer or SLB) drop-down list.

      The number of CLB instances that are displayed are the same as the number of CLB instances in the SLB console.

      Frontend Protocol Type

      The protocol that is used to forward requests.

      • HTTP: HTTP is suitable for applications that must identify data from different sources, such as web applications and mobile games.

      • HTTPS: HTTPS is suitable for applications that require encrypted data transmission.

      Port

      The listening port that is used to receive requests and forward the requests to backend services or applications. Valid values: 1 to 65535. Example: 80.

      SSL Certificate

      This parameter is required only if you set the Protocol Type parameter to HTTPS.

      If your account does not have SSL certificates, log on to the CLB console to create SSL certificates.

      Custom Forwarding Policy

      • Domain Name: the domain name from which requests are forwarded.

      • Path: the path from which requests are forwarded. For example, if a path is example.com/product/sae, set the request forwarding path to /product/sae.

      • Backend Application: the application that receives requests. The backend application must reside in the same namespace as the application from which requests are forwarded.

      • Container Port: the port of the container that is used to access the backend application.

      Default Forwarding Policy

      • Backend Application: the backend application that receives requests.

      • Container Port: the port of the container that is used to access the backend application.

    Note
    • The ports to which an SLB instance listens must be unique.

    • You cannot specify the same port for a CLB instance in different gateway routing rules.

    • You must specify a domain name in the example.com format. You must configure the Path and Domain Name parameters.

    • If you do not configure a custom forwarding policy, SAE uses the default forwarding policy. If you do not configure a default forwarding policy, an access error may occur.

  5. Verify the result.

    • On the Event Information page of the namespace, check whether the routing rule is configured.

    • Log on to the SLB console. On the CLB Instances page, check whether the listener is configured.

    • Use a URL in the <Domain name>:<Port number>/Path format to access the related backend services or applications.

Manage a gateway route

After you create a routing rule, you can view the forwarding policy, modify the gateway route, and view the related events on the Gateway Routing page.