Services and Routes
Services and Routes are the fundamental building blocks for traffic routing in API7 Gateway. Together, they define how the gateway matches incoming requests and where it proxies them.
Service
A Service is a logical grouping of routes that share common backend (Upstream) and plugin configurations. In a microservices architecture, a Service typically represents a single business capability or microservice (e.g., "User Service" or "Payment Service").
Key fields
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Unique name for the service. Max 100 characters. |
type | string | No | http (default) or stream. |
hosts | array | No | List of domain names the service accepts. Max 32 items. |
path_prefix | string | No | The listening path prefix. Must start with /. |
strip_path_prefix | boolean | No | If true (default), the path_prefix is removed before proxying to the upstream. |
upstream | object | No | Backend target configuration. |
plugins | object | No | Plugins applied to all routes in this service. |
Route
A Route defines specific matching rules (URI, HTTP method, host) for incoming requests within a Service. When a request matches a Route, the gateway applies the defined policies and proxies the request to the Service's Upstream.
Key fields
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Unique name for the route. |
paths | array | Yes | List of URL paths (after path_prefix) to match. Max 64 items. Each must start with /. |
methods | array | No | Allowed HTTP methods (e.g., GET, POST). If empty, all methods are allowed. |
vars | array | No | Advanced matching rules using API7 Expressions. |
priority | integer | No | Matching priority. Higher values win. Default is 0. |
enable_websocket | boolean | No | Enables WebSocket proxying for the route. |
plugins | object | No | Plugins specific to this route. |
Request flow
The following diagram shows how a request flows through Routes and Services to the backend:
Enterprise vs. open source workflow
In API7 Enterprise, configuration changes follow a controlled lifecycle to ensure stability and auditability.
| Feature | Open Source APISIX | API7 Enterprise |
|---|---|---|
| Persistence | Immediate update to Data Plane (via etcd). | Saved as Service Template in Control Plane database. |
| Versioning | No built-in versioning for entities. | Explicit Service Versions created from templates. |
| Deployment | Changes take effect as soon as they are saved. | Versions must be Published to a Gateway Group. |
| Audit | Minimal change tracking. | Full audit logs and version history. |