For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.
Backend tunnel proxy
Use the tunnel policy to route backend connections through an HTTP proxy for JWKS fetching and other outbound traffic.
Use the AgentgatewayBackend tunnel policy to route backend connections through an HTTP proxy server. This is useful in environments where outbound traffic must pass through a corporate proxy, such as for JWKS retrieval or accessing AI providers behind a network egress point.
About the tunnel policy
The tunnel field on an AgentgatewayBackend configures an HTTP CONNECT tunnel to the target backend. Agentgateway establishes an HTTP tunnel through the proxy and forwards all requests to the upstream endpoint.
The tunnel supports Service and AgentgatewayBackend types as the proxy target.
Before you begin
- Set up an agentgateway proxy.
- Have access to an HTTP proxy (forward proxy) in your cluster, such as Squid.
Configure a tunnel for JWKS fetching
This example configures an agentgateway backend that connects to an upstream identity provider (IdP) through a Squid forward proxy. The tunnel is used for JWKS (JSON Web Key Set) retrieval.
Deploy the proxy backend AgentgatewayBackend that points to your proxy server.
kubectl apply -f- <<EOF apiVersion: agentgateway.dev/v1alpha1 kind: AgentgatewayBackend metadata: name: squid-proxy namespace: agentgateway-system spec: static: host: squid-proxy.proxy-namespace.svc.cluster.local port: 3128 EOFCreate the main backend with the
tunnelpolicy that references the proxy.kubectl apply -f- <<EOF apiVersion: agentgateway.dev/v1alpha1 kind: AgentgatewayBackend metadata: name: idp-proxied namespace: agentgateway-system spec: static: host: idp.provider.com port: 443 policies: tls: insecureSkipVerify: true tunnel: backendRef: group: agentgateway.dev kind: AgentgatewayBackend name: squid-proxy port: 3128 EOFSetting Description spec.static.hostThe upstream backend host (the actual service you want to reach) spec.policies.tunnel.backendRef.nameThe AgentgatewayBackend or Servicethat represents the proxyspec.policies.tunnel.backendRef.portThe port the proxy listens on spec.policies.tls.insecureSkipVerifySkip TLS certificate validation when connecting to the upstream backend. Use with caution — only in trusted environments. Agentgateway now routes all outbound connections from
idp-proxiedthrough thesquid-proxytunnel. When the control plane needs to fetch JWKS keys, it does so via the proxy.