All Products
Search
Document Center

Microservices Engine:Route traffic to MSE Nacos services through a cloud-native gateway

Last Updated:Mar 11, 2026

A cloud-native gateway unifies traffic gateways and microservice gateways into a single layer, which reduces network hops and operational overhead while providing built-in traffic governance and observability.

This tutorial walks you through three tasks:

  1. Create a route that forwards requests to a service registered in an MSE Nacos registry.

  2. Verify the route works.

  3. Add a throttling policy to protect backend services from traffic surges.

Prerequisites

Before you begin, make sure the following resources are ready:

Important

Cloud-native gateways cannot associate with on-premises services registered in MSE Nacos or ZooKeeper registries.

Step 1: Create a route

  1. Log on to the MSE console. In the top navigation bar, select a region.

  2. In the left-side navigation pane, choose Cloud-native Gateway > Gateways. Click the name of your gateway.

  3. In the left-side navigation pane, click Routes, then click Add Route.

  4. Configure the route with the following settings:

    ParameterValue
    Routing Rule Namespringcloud-demo
    Domain name* (wildcard)
    Path typePrefix
    Path value/
    Route PointSingle Service

    Add Route page configuration

  5. In the Service Name drop-down list, click Associate Service. In the Associate Service panel, configure the parameters for your environment and click OK.

    Associate Service panel

  6. Select nacos-service-consumer from the Service Name drop-down list, then click Save and Advertise.

The route is now active and forwards all incoming requests to the specified Nacos service.

Step 2: Verify the route

Before adding any routing policy, confirm that the gateway correctly forwards traffic to the backend service.

  1. Log on to the MSE console. In the top navigation bar, select a region.

  2. In the left-side navigation pane, choose Cloud-native Gateway > Gateways. Click the name of your gateway.

  3. On the Overview page, click the Gateway Ingress tab. Note the ingress IP address.

    Gateway Ingress tab showing the ingress IP address

    Note

    The ingress IP address belongs to a Server Load Balancer (SLB) instance associated with the gateway. To use a self-managed SLB instance instead, see Manage SLB instances that are specified as Ingresses.

  4. Send a test request:

    curl -I http://<gateway-ingress-ip>/echo-rest/hello

    Replace <gateway-ingress-ip> with the ingress IP address from the previous step. To test your own backend service, replace /echo-rest/hello with its path.

    Expected response:

    HTTP/1.1 200 OK
    Content-Type: text/plain;charset=UTF-8
    Content-Length: 5
    Date: Thu, 29 Aug 2024 08:21:47 GMT
    req-cost-time: 9
    req-arrive-time: 1724919707979
    resp-start-time: 1724919707988
    x-envoy-upstream-service-time: 8
    server: istio-envoy

    An HTTP/1.1 200 OK response confirms the route is working.

Step 3: Add a throttling policy

In high-concurrency scenarios, unthrottled traffic can overload backend services, causing slow responses or outages. A throttling policy monitors the queries per second (QPS) of a route and blocks traffic that exceeds the threshold.

For a full list of routing policies, see Routing policies.

Configure the throttling rule

  1. Log on to the MSE console. In the top navigation bar, select a region.

  2. In the left-side navigation pane, choose Cloud-native Gateway > Gateways. Click the name of your gateway.

  3. Click Routes. Find the route you created and click Policies in the Actions column.

  4. In the Policies section, click the Throttling tab, then click Flow control rules.

  5. On the Throttling Rules tab, configure the following parameters:

    ParameterDescriptionExample
    Overall QPS ThresholdMaximum requests per second allowed for this route.1
    Web Fallback BehaviorAction when the threshold is exceeded. Options: Returns the specified content or Jump to the specified page.Returns the specified content
    HTTP status codeStatus code returned when a request is throttled. Default: 429.429
    Returned Content-TypeFormat of the response body. Options: Plain text or JSON.Plain text
    HTTP TextCustom message returned to throttled requests.springcloud-demo flow limit
    Whether to openToggle to enable or disable the rule.image

    Throttling rules configuration

  6. Click New to create the rule, or click Save to update an existing rule. In the confirmation dialog, click OK.

Verify the throttling policy

Send rapid consecutive requests to trigger the throttling threshold. Use the script for your operating system:

Linux / macOS

#!/bin/bash

URL="http://<gateway-ingress-ip>/echo-rest/hello"

while true; do
    curl -i -s $URL
done

Windows

@echo off

set "localUrl=http://<gateway-ingress-ip>/echo-rest/hello"

:loop
curl -i -s %localUrl%

goto loop

Replace <gateway-ingress-ip> with the ingress IP address of your gateway.

Once QPS exceeds the threshold, the gateway returns 429 Too Many Requests:

HTTP/1.1 429 Too Many Requests
content-type: text/plain; charset=UTF-8
content-length: 26
date: Thu, 29 Aug 2024 08:54:46 GMT
server: istio-envoy

springcloud-demo flow limit

Requests within the threshold continue to return 200 OK:

HTTP/1.1 200 OK
Content-Type: text/plain;charset=UTF-8
Content-Length: 5
Date: Thu, 29 Aug 2024 08:54:46 GMT
req-cost-time: 8
req-arrive-time: 1724921686961
resp-start-time: 1724921686970
x-envoy-upstream-service-time: 7
server: istio-envoy

The mixed output confirms throttling is working. Requests that exceed the QPS threshold return 429, while those within the limit return 200.

What to do next