Skip to main content
Agentgateway supports TLS in two directions:
  • Listener TLS (tls) — TLS termination on the inbound listener. Clients connect over HTTPS/TLS.
  • Backend TLS (backendTLS) — TLS origination when connecting to upstream backends. Agentgateway establishes encrypted connections to backends.
Only TLS 1.2 and 1.3 are supported.

Listener TLS

Listener TLS is configured on binds[].listeners[]:
binds:
- port: 3000
  listeners:
  - name: default
    protocol: HTTPS
    tls:
      cert: examples/tls/certs/cert.pem
      key: examples/tls/certs/key.pem
tls
object
TLS configuration for the listener.

Backend TLS

Backend TLS is configured under binds[].listeners[].routes[].policies:
binds:
- port: 3000
  listeners:
  - routes:
    - policies:
        backendTLS:
          hostname: backend.example.com
          root: /etc/ssl/certs/ca-certificates.crt
backendTLS
object
TLS configuration for connections to upstream backends.

Examples

binds:
- port: 443
  listeners:
  - name: secure
    protocol: HTTPS
    tls:
      cert: /etc/ssl/certs/server.crt
      key: /etc/ssl/private/server.key
      minTLSVersion: "1.3"
      maxTLSVersion: "1.3"
    routes:
    - backends:
      - mcp:
          targets:
          - name: everything
            stdio:
              cmd: npx
              args: ["@modelcontextprotocol/server-everything"]
binds:
- port: 443
  listeners:
  - name: mtls
    protocol: HTTPS
    tls:
      cert: /etc/ssl/certs/server.crt
      key: /etc/ssl/private/server.key
      root: /etc/ssl/certs/ca.pem
binds:
- port: 3000
  listeners:
  - routes:
    - policies:
        backendTLS:
          cert: /etc/ssl/client.crt
          key: /etc/ssl/client.key
          root: /etc/ssl/certs/backend-ca.pem
          hostname: backend.example.com
          alpn:
          - h2
      backends:
      - host: https://backend.example.com
Setting insecure: true disables all certificate verification. Only use this for local development or in fully trusted private networks. Never use it in production environments.
Listener TLS requires setting the protocol field on the listener to HTTPS. Routes under that listener will receive decrypted traffic.