The Request Flow
A user or service sends an access token in the Authorization header. Envoy checks the token signature using public keys from the JWKS endpoint. Envoy also checks issuer, audience, and expiry. If the token is invalid, the request stops at the edge.
Envoy JWT Authn Example
This config validates JWTs for API routes. It is a teaching example: replace issuer, audience, cluster names, and routing with your real platform values.
http_filters:
- name: envoy.filters.http.jwt_authn
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.jwt_authn.v3.JwtAuthentication
providers:
platform_idp:
issuer: https://login.example.com
audiences:
- product-platform
remote_jwks:
http_uri:
uri: https://login.example.com/.well-known/jwks.json
cluster: platform_idp_jwks
timeout: 2s
cache_duration: 300s
forward: true
payload_in_metadata: verified_jwt
rules:
- match: { prefix: "/api/" }
requires:
provider_name: platform_idp
- name: envoy.filters.http.router
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
What Envoy Can Decide Locally
- The token is signed by a trusted key.
- The issuer is allowed.
- The token is meant for this platform or API audience.
- The token has not expired.
What Envoy Should Not Guess
JWT validation does not automatically mean the user can perform every action. If the API needs row-level, tenant-level, billing-plan, or product-object permissions, call an authorization service or let the product perform a domain-specific check.
JWKS Caching
JWKS caching keeps token verification fast. The tradeoff is key-rotation timing. Your IdP, Envoy cache duration, and emergency key revocation process must be designed together.