TLS & Reverse Proxy
zero does not terminate TLS in-process. The HTTP server listens on plain HTTP (HTTP_PORT, default 8080). TLS termination is the job of a reverse proxy in front of zero: a proxy (nginx, Caddy, Traefik, …) owns the certificate and forwards cleartext to zero. That is the supported, tested deployment.
zero's bundled TLS layer (zero.tlso) is client-side only — it is used for outbound connections (Postgres/MySQL SSL, Kafka/mTLS, outbound HTTP service calls, webhooks). Do not claim in-framework inbound TLS termination; it does not exist yet.
Reverse proxy example (nginx)
server {
listen 443 ssl;
server_name api.example.com;
ssl_certificate /etc/letsencrypt/live/api.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/api.example.com/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
# Forward the real client identity to zero.
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}The equivalent in Caddy is a one-liner:
api.example.com {
reverse_proxy 127.0.0.1:8080
}Caddy auto-provisions and renews the certificate and sets the X-Forwarded-* headers for you. See Kubernetes for the chart's ingress and TLS-secret settings.
Trusted-proxy headers and rate limiting
When zero sits behind a proxy, client IPs arrive via X-Forwarded-For, not the socket peer. Configure the limiter to (a) key by that header and (b) only trust it from your known proxy IPs, so a client cannot spoof the header to dodge the limit:
# The proxy's IP(s). Comma-separated. Only these may assert X-Forwarded-For.
RATE_LIMIT_TRUSTED_PROXIES=127.0.0.1,10.0.0.1
# Key the limit by the forwarded client IP instead of the socket peer.
RATE_LIMIT_KEY=header:X-Forwarded-For
# Optional: per-window cap (defaults apply if omitted).
RATE_LIMIT_MAX=100
RATE_LIMIT_WINDOW=60WARNING
Without RATE_LIMIT_TRUSTED_PROXIES, a header: rate-limit key still works but any client can forge X-Forwarded-For to reset its own counter. Set the trusted list whenever you key by a forwarded header. See Rate Limiter.
Outbound calls (webhooks, services, databases)
zero makes outbound HTTPS requests (service clients, webhook targets, DB SSL) through the OpenSSL-backed client TLS layer. It enforces a minimum of TLS 1.2 and verifies the peer certificate by default. Mutual TLS is available where the backend supports it (for example KAFKA_TLS_* for mTLS). No inbound termination is performed by zero itself.
Per-backend keys live in Configuration: DB_SSL_MODE (Postgres), MYSQL_SSL_MODE, REDIS_TLS_*, CASSANDRA_TLS_*, MONGODB_TLS and MONGODB_TLS_VERIFY, and KAFKA_TLS_*.