Skip to content

Reverse Proxies & Trusted IPs

By default, Kova ignores X-Forwarded-For and CF-Connecting-IP so untrusted callers cannot spoof rate limits or Activity Log IPs.

When deploying behind a reverse proxy, set KOVA_TRUSTED_PROXIES strictly to your proxy’s own IP address—for example 127.0.0.1/32 when Caddy or Nginx runs on the same host, or <proxy-ip>/32 (such as 172.30.0.10/32 in the Caddy TLS stack) when running over Docker:

# Host-local Caddy/Nginx:
KOVA_TRUSTED_PROXIES=127.0.0.1/32
# Or dedicated Docker proxy IP (Dokploy / Coolify / Compose TLS):
KOVA_TRUSTED_PROXIES=172.30.0.10/32

Never list broad RFC1918 ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) or an entire shared container subnet; other workloads or LAN peers would then be able to forge client IPs. When using a numeric hop count (e.g. KOVA_TRUSTED_PROXIES=1), Kova honors forwarded headers only when the TCP connection arrives from a loopback or RFC1918 proxy peer.

Generic reverse proxies (such as Caddy or Nginx) pass any client-sent CF-Connecting-IP header through unchanged, so Kova ignores CF-Connecting-IP by default even behind a trusted proxy. If Kova sits directly behind Cloudflare, explicitly opt in:

KOVA_CLIENT_IP_HEADER=cf-connecting-ip
kova.example.com {
reverse_proxy kova:3000
}