When a cloud-native API gateway receives a request, it attempts to match the request with your routing rules. The gateway checks the rules in descending order of priority. If a rule matches, the gateway forwards the request to the backend service defined in that rule. If no rules match, the gateway returns a 404 error.
Routing match priority
If multiple routing rules exist, they are prioritized from highest to lowest in the following order: Associated Domain > Path > Header > Query > Creation Time. The detailed rules are as follows:
Associated Domain: The longer the domain name string, the higher the priority.
Path:
If the Match Rules are different, the priority is as follows: Exact > Prefix > Regular Expression.
If the Match Rules are the same: The longer the Path string, the higher the priority.
Header: The more key-value pairs, the higher the priority.
Query: The more key-value pairs, the higher the priority.
Creation Time: The earlier the creation time, the higher the priority.
Procedure
You can create a route for a cloud-native API gateway in two ways: from outside an instance or from within an instance.
From outside an instance
Log on to the Cloud-native API Gateway console. In the navigation pane on the left, choose APIs. In the top menu bar, select a region.
Click the target API. From the drop-down list, select the target instance or All Instances.

Click Create Route.
From within an instance
Log on to the Cloud-native API Gateway console. In the navigation pane on the left, choose Instances. In the top menu bar, select a region.
On the Instances page, click the ID of the target gateway instance. In the navigation pane on the left, choose APIs, and then click the target API.
Click Create Route.
On the Create Route page, configure the parameters, and then click Save or Save & Publish.
NoteMatch rules are combined with a logical AND. The more rules you add, the narrower the match scope.
The matching priority of routes corresponds to the order in which they are displayed on the route configuration page.
Configuration Item
Description
Route Name
Enter a custom name for the route.
Route Description
Click Add Route Description and enter a description for the route.
Domain Name
Select one or more domain names for the route to match.
To create a new domain name, click Add Domain Name and create one in the panel.
Path
Set the Path parameter to match in HTTP requests.
If the match rules are the same, a longer Path has a higher priority.
If the match rules are different, the priority is: Exact > Prefix > Regular Expression Match.
Exact: An exact match. For example, the Path is exactly
/user.Prefix: Matches based on a prefix. For example, the Path starts with
/user.Regular Expression: Matches based on a regular expression.
Method
Set the Method parameter to match in HTTP requests. You can select multiple HTTP methods. The default value is ANY.
Header
Set the Header parameters to match in HTTP requests. If the match rules are the same, a higher number of parameters results in a higher priority.
Query
Set the Query parameters to match in HTTP requests. If the match rules are the same, a higher number of parameters results in a higher priority.
Instance
Select the cloud-native API gateway instance where the route takes effect.
Scenarios
Select the target service type for the current route.
Basic scenario: Single Service
Grayscale release scenario: By Weight (Multi-service), By Tag (Tag-based Routing)
Other scenarios: Mock, Redirection
For more information about the different types of target services, see routing.
NoteThe sum of traffic weights for all target services must be 100%.
Backend Service
Select an associated backend service and port.
NoteYou can click Associate Service to select a source and a service in the panel.
Different source types have different limits on the number of sources you can add.
Container Service: A maximum of 5 sources.
Nacos and Zookeeper: Only one source.
Timeout (seconds)
Enter the timeout duration. The default value is 60 seconds. A value of 0 means no timeout.
Fallback
Set a fallback service. You must select a specific service. When the backend service that the route points to has no active nodes, the original request is sent to the specified fallback service.
NoteCurrently, the fallback feature is supported only between HTTP services.
Retries
Enter the number of retries. The default value is 2. A value of 0 disables retries.
Retry Conditions
Select the retry conditions.
Retry Status Codes
Add one or more status codes that trigger a retry.