Skip to main content
Routes live inside listeners and define how agentgateway matches and handles incoming HTTP requests. Each route specifies optional matching criteria, an optional set of policies, and the backends to forward matching traffic to.

Fields

string
A human-readable name for this route. Used in logs, traces, and metrics. Recommended for configurations with multiple routes.
string
The namespace this route belongs to. Used when agentgateway is managed by a control plane. Can be omitted for local file-based configurations.
string
An internal rule identifier, used by the XDS control plane. For local configurations, omit this field.
string[]
Additional hostname constraints for this route. Requests must match both the parent listener’s hostname and the route’s hostname. Accepts wildcards, e.g. "*.example.com".When omitted, the route matches any hostname accepted by the listener.
array
An array of match criteria. A request must satisfy all conditions within a single match object. If multiple match objects are listed, a request matching any one of them qualifies.When matches is omitted entirely, the route matches all requests.
object
Traffic policies applied to requests and responses that match this route. All policies are optional.See Policies below for the full list.
array
The backends to forward matched traffic to. See Backends for the full type reference.

Route priority and matching order

Routes are evaluated in the order they appear in the configuration. The first route whose match conditions are satisfied handles the request — subsequent routes are not evaluated. Routes without a matches block match every request. Place them last to act as a catch-all fallback.

Matching examples

Match by path prefix, method, query parameter, and header

This example is from the HTTP example config. It matches GET /match?param=hello requests with an x-header matching a numeric pattern.
http/config.yaml
Test with:

Multiple match objects (OR logic)

A request matching either condition is accepted.

Wildcard hostname on route

Catch-all with no match conditions

Policies

Policies are applied to all requests matching this route. Multiple policies can be combined.
Add, set, or remove HTTP headers before the request reaches the backend.
  • add — append a header (preserves existing values).
  • set — overwrite a header.
  • remove — delete a header.
Add, set, or remove HTTP headers on the response.
Handle CORS preflight requests and append CORS headers to applicable responses.
Modify the request URL path or Host header before forwarding to the backend.
Return a redirect response directly from the gateway without contacting the backend.
Return a static response body and status code without contacting any backend.
Duplicate a percentage of incoming requests to a mirror backend. The mirror response is discarded.
Limit incoming requests using a local in-process token bucket. State is not shared across gateway replicas.
Evaluate CEL expressions against request attributes to allow or deny access.
Validate JWT tokens presented by MCP clients. Supports Auth0, Keycloak, and generic JWKS sources.
Apply CEL-based authorization rules specifically to MCP traffic.
Enable A2A protocol processing and telemetry for this route. Required when using A2A backends.
Configure the TLS connection agentgateway establishes with the upstream backend.
See Policies: TLS for the full field reference.
Attach credentials when connecting to upstream services. Supports passthrough, static API keys, GCP, AWS, and Azure.
See Backends for all backendAuth variants.
Validate JWT tokens for any HTTP route (not limited to MCP). Makes JWT claims available as jwt.<claim> in CEL expressions.
See Policies: Authentication for full reference.
Delegate authorization decisions to an external service via HTTP or gRPC.
Timeout requests that exceed the configured duration.
Retry failed requests automatically. From the HTTP example source:
Mark this route as LLM traffic and enable AI-specific features such as prompt guards and prompt enrichment.
See Policies: AI Prompt Guard for details.