Routes
API7 Gateway can function in two primary modes:
Application-Layer Proxy: In this mode, API7 Gateway acts as an intermediary for HTTP requests and responses, operating at the application layer (layer 7) of the OSI model. Routes are used to define how these HTTP requests are handled.
Stream Proxy: API7 Gateway can also function as a stream proxy, operating at the transport layer (layer 4) of the OSI model. This mode is ideal for handling protocols like TCP and UDP. For stream proxying, stream routes are used to define how incoming TCP/UDP connections are routed to backend services.
A route matches client requests based on configured rules, loads and executes related plugins, and forwards requests to the specified upstream nodes. A route must belong to a single service. It cannot be isolated or shared across multiple services.
How Route Works
Think of API7 Gateway as a smart traffic director for your APIs. When a request arrives, API7 Gateway checks its defined routes to find the best match and directs the request to the appropriate backend service.
Imagine you have an API with a route for /pet
. This route might match requests like GET /pet
or POST /pet/create
. The route can also be configured to apply specific plugins (e.g., for rate limit or authentication) before forwarding the request to the appropriate backend server.
The diagram illustrates how to send two HTTP requests to the API7 Gateway, which are then forwarded based on the configured rules in routes: