Gateway Integration
In production, a gateway (reverse proxy, ingress controller, or service mesh) often sits in front of the NeMo Platform. This page explains how authorization works with and without gateway-level auth, what headers the gateway must set, and which paths skip authorization.
For the security architecture, see Security Model.
Overview
NeMo Platform’s authorization middleware runs inside each service. Every request is evaluated there unless auth is disabled or the request matches a bypass path. Optionally, the gateway can perform the authorization check (e.g., via Envoy ext_authz) and forward the request with a special header so that services trust the gateway’s decision and do not call the PDP again. That reduces latency and centralizes auth at the edge.
Two Authorization Models
Service-Level Auth (Default)
- The gateway forwards requests unchanged (aside from routing/TLS).
- Each service’s middleware validates the token (or principal headers) and calls the PDP.
- No gateway auth configuration required. Easiest to set up.
Gateway-Level Auth
- The gateway calls the PDP (e.g., via Envoy
ext_authz) before forwarding. - If the PDP allows the request, the gateway adds headers and forwards; otherwise it returns 403.
- Services see
x-nmp-authorized: trueand the principal headers, and skip their own PDP call. - Benefit: One auth check per request at the edge; lower latency and fewer PDP calls.
To use gateway-level auth you must configure your gateway to call the NeMo Platform PDP and set the headers described below on allowed requests.
Security Requirement: Your ingress/gateway must strip the following headers from all incoming external requests before forwarding to NeMo Platform:
X-NMP-Principal-Id,X-NMP-Principal-Email,X-NMP-Principal-Groups,X-NMP-Principal-On-Behalf-OfX-NMP-Authorized,X-NMP-Scopes
If external clients can set these headers, they can forge any identity or bypass authorization entirely. The gateway should also block external access to /internal/* paths (used for service-to-service communication).
Required Headers (Gateway-Level Auth)
When the gateway has already authorized the request, it must set:
Header names are case-insensitive; services normalize them.
Bypass Paths
The following are not subject to authorization checks; they are always allowed:
- Health and readiness:
/health,/healthz,/ready,/readyz,/health/live,/health/ready,/metrics - Discovery:
/apis/auth/discovery(for CLI/SDK OIDC discovery) - PDP endpoints: Paths under
/apis/auth/v2/authz/are restricted to service principals only. The middleware rejects external and regular-user requests automatically. - Studio: Paths under
/studio(the Studio UI handles its own OIDC login)
Configure the gateway so these paths are not sent to the PDP (or are always allowed) when using gateway-level auth.
Gateway Configuration Examples
Envoy ext_authz
Envoy ext_authz filter configuration
Replace placeholder values before applying this configuration.
Header Stripping
Configure your gateway to remove NeMo Platform auth headers from incoming external requests. This prevents clients from forging identities.
Envoy header stripping
Add request_headers_to_remove to your route configuration:
Testing Gateway Auth
After configuring gateway-level auth, verify:
- Headers are set correctly — Make a request through the gateway and check that
X-NMP-AuthorizedandX-NMP-Principal-Idare present on the service side. - Headers are stripped from external requests — Try sending
X-NMP-Authorized: truefrom outside; verify it is stripped by the gateway.
Related
- Auth Configuration — Enabling auth and PDP provider (embedded vs OPA).
- Security Model — Trust boundaries and gateway trust model.
- Production Hardening — Security checklist including gateway requirements.