How requests are handled
For every request, the gateway decides which service receives it, who the caller is, whether the caller has exceeded a usage limit, and which headers are passed on. Everything is driven by one YAML file passed with --gConfigPath.
Request pipeline
Section titled “Request pipeline”- Route match. Routes whose header matches the request are checked first, and the highest priority wins. If none matches, the request path is matched against the
PathPatternof every route and the longest matching pattern wins. No match returns404. - Authentication. If an authentication method applies to the route, the token is validated. A missing or invalid token returns
401, unless the method hasAllowAnonymous, which lets a request with no credential through as anonymous (an invalid or expired token is always refused). If the route has required scopes and the token lacks one, the request gets403. The identity inside the token becomes the caller ID, and it is checked against the usage control rules. A caller over the limit gets429. - Client identification. If no authentication method applies, the route’s client ID rule decides how the caller is identified, and each identifier found is checked against the usage control rules. If none of the rule’s modes finds an identifier, the request gets
401withMissing identification value, see client ID rules. - Header shaping. The header rule of the route decides which headers are forwarded, removed or added.
- Forwarding. The path is optionally rewritten and the request is sent to the backend. If the backend can’t be reached, the caller gets an error response.
- Logging. One access log line is written for the request, unless an access log rule filters it, and Prometheus metrics are updated when enabled.
Where rules apply: global, server, route
Section titled “Where rules apply: global, server, route”Rules (header, client ID, usage control) and authentication methods are defined once and then referenced by name from three places:
GlobalConfig: the default for everything.- A server in
ServerConfigs: applies to every route that targets the server. - A route in
ServerRoutes: applies to that route only.
For header rules, client ID rules and authentication methods, the closest scope wins: route, then server, then global. Usage control rules are different, they can stack, and required scopes add up unless a level sets ScopesMode: Override. See Usage control and Authentication.
Features
Section titled “Features”| Feature | What it does | Page |
|---|---|---|
| Servers and routes | Map public paths to backend services, rewrite paths, reach backends over HTTPS with a custom CA | Servers and routes |
| Protocols | Proxy gRPC (cleartext and TLS) and WebSocket next to REST, with per-server limits, MaxStreams and stream metrics |
Servers and routes |
| Header rules | Choose which request headers reach the backend, remove or add headers, preserve the original Host |
Header rules |
| Client ID rules | Decide how a caller is identified (IP, token, header, query string) | Client ID rules |
| Usage control | Rate limit callers per global, server or route scope | Usage control |
| Authentication | Validate signed JWTs, OAuth2 tokens (JWKS or introspection) and encrypted JWE tokens, and require scopes, before a request is forwarded | Authentication |
| Config check | Validate a config file without starting the gateway | Command line |
| Logs and metrics | Gateway log, access log and Prometheus metrics | Logs and metrics |
