PostHog Client IPs Behind Reverse Proxies: A Gotcha
PostHog wasn’t tracking client IPs correctly behind my reverse proxy. NextJS logged the right IPs, Caddy sent the right headers, but PostHog’s dashboard showed everyone visiting from my VPS in Frankfurt. This broke geographic analysis and location-based feature flags. Here’s what I tried and what actually worked. The Setup My application stack: NextJS application Caddy reverse proxy (handles SSL) PostHog Cloud for analytics The proxy setup is standard: Caddy receives requests, sets proper headers, passes them to NextJS. ...