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 demo application on SAE.
- 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 SLB overview.
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
- 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.
Create a gateway route
- Log on to the SAE console.
- In the left-side navigation pane, click Applications. In the top navigation bar, select a region and click the name of an application.
- 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.
- In the Create Routing Rule panel, configure the parameters. 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.
- 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.