All Products
Search
Document Center

Serverless App Engine:Set up routing rules for an application (API Gateway)

Last Updated:Apr 01, 2026

Route incoming traffic to your SAE applications using a cloud-native API Gateway. This guide walks you through creating a gateway route in the SAE console and explains the key configuration options.

Background

A cloud-native API Gateway is a unified solution that combines traffic gateways, microservice gateways, security gateways, and AI gateways into a single platform. It handles service discovery, load balancing, and cross-service communication, replacing the fragmented setup that traditional distributed gateways require. For more information, see What is a cloud-native API gateway?.

Prerequisites

Before you begin, ensure that you have:

Create a gateway route

  1. Go to the SAE Gateway Routing page, select a region and namespace, and then click Create Gateway Route.

  2. On the Create Route page, configure the following parameters and click Save.

Basic settings

ParameterDescriptionExample
Route nameA custom name for the routing rule.demo
Network typeThe network through which requests are forwarded. Internet: traffic from the public internet, charged based on actual forwarded traffic. Private: traffic within the current VPC only, not charged.Internet
Gateway typeSelect Cloud-native API Gateway.Cloud-native API Gateway
Gateway instanceRequired when Gateway type is Cloud-native API Gateway. Select an instance in the same region and VPC as the namespace. To create a new instance, click Create Cloud-native API Gateway. See Create a cloud-native API Gateway instance.demo
Domain nameOne or more domain names to match. To add a new domain, click Create Domain Name. See Create a domain name.www.demo.com

Matching conditions

Configure how the gateway identifies which requests this route handles.

Path matching

Set the path pattern to match in HTTP requests.

Match typeBehaviorExample
EqualsExact match only./user matches /user only.
PrefixMatches any path starting with the value./user matches /user, /user/profile, and /user/settings.
Regular expressionMatches paths against a regex pattern.user (character class) matches paths containing that pattern.

When multiple rules share the same match type, the rule with the longer path takes priority. Across match types, priority runs: Equals > Prefix > Regular expression.

Priority example

The table below shows which route SAE selects for sample requests:

Request pathSelected routeReason
/userEquals: /userExact match takes highest priority.
/user/profilePrefix: /userNo exact match; prefix catches it.
/accountRegex: userNo exact or prefix match; regex applies.

Other matching conditions

ParameterDescriptionExample
MethodHTTP methods to match. Leave blank to match all methods.GET
Request headerHeader name, match type, and value. When multiple rules share the same conditions, the rule with more header parameters wins.Name: demo, Condition: Prefix, Value: value
Request parameter (Query)Query string key, match type, and value. When multiple rules share the same conditions, the rule with more query parameters wins.Key: key, Condition: Prefix, Value: value

Service source and backend

Service source

Select the service registry that matches how your application registers itself.

OptionWhen to use
MSE NacosApplication uses MSE Nacos for service registration and discovery. Requires selecting an MSE Nacos instance and MSE Nacos namespace.
K8s ServiceApplication uses Kubernetes ServiceNames. Supports multi-language service registration and discovery, and assigns fixed domain names to avoid IP address changes after deployment.
The service source must match the service registration and discovery method used by your application.

Scenarios and backend service

ParameterDescriptionExample
ScenariosSingle service: routes all matching requests to one backend. Multiple services (canary release): splits traffic across multiple backends by weight. See Overview of routing methods.Single service
Backend serviceThe target application, service name, protocol, and port. When using multiple services, all traffic weight percentages must add up to 100%.Application: demo, Service: demo, Protocol: Auto Read, Port: 80

Canary release example

In a canary release (multiple services scenario), you can split traffic by percentage to validate a new version before full rollout:

  • Stable version (demo-v1): 90% of traffic

  • Canary version (demo-v2): 10% of traffic

Once the canary version is stable, gradually shift the percentage until it handles 100% of traffic.

Advanced configuration

ParameterDescriptionDefaultExample
FallbackEnable to specify a fallback service. When no healthy node is available for the primary backend, the gateway forwards requests to the fallback service instead. Currently supported only between HTTP services.OffEnabled
Timeout (s)Maximum time in seconds the gateway waits for a backend response. Set to 0 for no timeout.6060
RetriesNumber of retry attempts after a failed request. Set to 0 to disable retries.2
Retry conditionsEvents that trigger a retry attempt. See Configure a retry policy.connect-failure, cancelled
Retry status codesHTTP status codes that trigger a retry.502

Manage routing rules

After creating a route, go to the Gateway Routing page to view, edit, or delete gateway routes.

Next steps