Routing
Routing refers to the process by which an API Gateway forwards client requests to the appropriate backend service based on specific paths or conditions. An API Gateway is a middleware layer that sits between clients and servers, used for managing, monitoring, and routing client API requests. Its routing functionality is one of the core features of an API Gateway.
In an API Gateway, routing is typically based on conditions such as URL paths, HTTP methods (e.g., GET, POST), request headers, query parameters, and more. When the API Gateway receives a client request, it decides which backend service to forward the request to based on pre-configured routing rules.
Operation Demonstrationโ
Adding a Routeโ
- Select the service you need to configure and enter its details page.
- Click on "Route".
- Click on "Add Route".
- Fill in the basic information for the route.
Field Descriptions
Field Name | Field Description |
---|---|
Intercept this request | Whether to intercept the requests of this interface |
Request Method | Supports common HTTP request methods like GET, POST, PUT, DELETE, and allows multiple selections |
Request Path | URI of the API, applied to the relative path in the request URL, supports Restful parameters and prefix matching |
Advanced Matching | Supports routing matches through request headers, parameters, and Cookies; allows multiple entries |
Forward Upstream Path | The relative path to be forwarded upstream |
Request Timeout | Defines the timeout for the gateway to forward requests and receive responses from upstream |
Retry Count | When forwarding requests to upstream fails, the gateway will automatically retry, with a maximum retry count |
Forward Upstream Headers | Allows creating, editing, and deleting parameters for forward upstream headers, primarily used for authentication between gateway and upstream |
Once completed, click the "Submit" button.
Editing a Routeโ
- Click the
Edit
button next to the route you want to edit.
- Fill in the route information.
After filling, click Submit
.
Deleting a Routeโ
- Click the
Delete
button next to the route you want to delete.
- In the pop-up window, click
Confirm
.