Prompt

How do I set up an access control gateway for mTLS and JWT on internal APIs?

Technology / API Platforms5 observationsLast seen Oct 21, 2026

Latest observation

Oct 21, 2026OpenAI APIWeb search: off

A good pattern is to put a gateway in front of your internal APIs that performs both transport authentication and request authentication/authorization:

  • mTLS proves the client service is a trusted workload.
  • JWT proves the caller has a valid identity/claims for the specific request.

1) Recommended architecture

Client service → Gateway → Internal API

At the gateway:

  1. Terminate mTLS

    • Validate the client certificate against your internal CA.
    • Optionally verify SAN/URI/DNS names and certificate rotation policy.
    • Map certificate identity to a service identity, team, or workload label.
  2. Validate JWT

    • Verify signature using JWKS or public keys from your IdP.
    • Check standard claims:
      • iss issuer
      • aud audience
      • exp, nbf, iat
      • optionally sub, scope, roles, tenant
    • Enforce audience per API or route.
  3. Authorize

    • Apply policy that combines:
      • certificate identity
      • JWT subject/claims
      • route/method
      • environment/tenant
    • Example: “service A with cert CN/SAN X may call GET /orders/* only if JWT has scope=orders.read.”
  4. Pass trusted identity downstream

    • Forward only sanitized identity headers or a signed internal token.
    • Do not blindly trust client-supplied X-User-* headers.

2) What to validate

mTLS checks

  • Cert chains to your private/internal CA
  • Cert is not expired
  • Revocation/rotation strategy is in place
  • SAN matches expected workload identity
  • Key usage and EKU are appropriate for client auth

JWT checks

  • Signature valid
  • iss matches your identity provider
  • aud matches the gateway/API
  • Token not expired
  • Optional: nonce/jti checks if needed
  • Claims match authorization policy

3) Policy model

A practical model is:

  • Authentication layer

    • mTLS required for all internal traffic
    • JWT required for all user/workflow/API requests
  • Authorization layer

    • RBAC or ABAC:
      • RBAC: roles/scopes
      • ABAC: attributes like service identity, namespace, tenant, environment

Example policy:

  • Allow if:
    • client cert SAN is spiffe://prod/ns/payments/sa/billing
    • JWT aud = internal-api
    • JWT scope contains payments:read
    • request is GET /v1/payments/*

4) Implementation options

Option A: API gateway / reverse proxy

Common choices:

  • Envoy
  • NGINX
  • Kong
  • Traefik
  • HAProxy

These can:

  • enforce mTLS
  • validate JWTs
  • integrate with ext-auth services
  • apply route-based policy

Option B: Service mesh

If this is east-west traffic between internal services:

  • Istio
  • Linkerd
  • Consul Connect
  • Cilium Service Mesh

A mesh often handles mTLS automatically, while the gateway handles JWT and app-level auth.


5) Example flow

  1. Client service connects to gateway using mTLS.
  2. Gateway authenticates the client cert.
  3. Client sends request with Authorization: Bearer <JWT>.
  4. Gateway verifies JWT against JWKS.
  5. Gateway evaluates policy:
    • cert identity allowed?
    • token audience correct?
    • scopes/roles sufficient?
  6. Gateway forwards request to internal API with trusted headers:
    • X-Client-Id
    • X-Client-Subject
    • X-User-Sub
    • X-Auth-Scopes

Optionally, the gateway can mint an internal signed token for backend services instead of forwarding the original JWT.


6) Example with Envoy-like logic

You generally configure:

  • Downstream TLS context for mTLS
  • JWT authn filter for token validation
  • RBAC/ext-authz for authorization

Conceptually:

  • Reject if client cert invalid
  • Reject if JWT invalid
  • Reject if cert identity and JWT claims don’t satisfy policy
  • Otherwise route to backend

7) Security best practices

  • Use a private CA for workload certs
  • Automate cert issuance and rotation
  • Keep token lifetimes short
  • Use least-privilege scopes
  • Separate service-to-service JWTs from human user JWTs
  • Strip incoming spoofable identity headers
  • Log auth decisions with correlation IDs
  • Cache JWKS and CA material safely
  • Enforce clock sync across systems
  • Prefer SPIFFE/SPIRE if you want standardized workload identity

8) A simple rule set to start with

If you want a strong baseline:

  • All internal API requests must use mTLS
  • All requests must include a valid JWT
  • Gateway checks:
    • cert subject/SAN matches service identity
    • JWT aud equals API name
    • JWT iss matches your IdP
    • JWT scope matches endpoint
  • Backend trusts only gateway-added identity context

9) If you want to implement quickly

Tell me what stack you use, and I can give you a concrete config for one of these:

  • Envoy
  • NGINX
  • Kong
  • Istio
  • AWS API Gateway / ALB
  • Kubernetes Ingress

If you want, I can also provide a sample Envoy YAML or NGINX config that enforces mTLS + JWT for a specific internal API.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (5 observations for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.