Posthog visitor IPs show as Cloudflare IPs

Hey there, I have an Astro project deployed on vercel and I use the Cloudflare proxy mode. However, for every posthog visitor it shows the cloudflare IP, even though I have set up X-Forwarded-For in my vercel.json: { "rewrites": [ { "source": "/ingest/static/:path(.*)", "destination": "https://eu-assets.i.posthog.com/static/:path*" }, { "source": "/ingest/:path(.*)", "destination": "https://eu.i.posthog.com/:path*" } ], "headers": [ { "source": "/(.*)", "headers": [ { "key": "X-Real-IP", "value": "{%CF-Connecting-IP%}" }, { "key": "X-Forwarded-For", "value": "{%CF-Connecting-IP%}" } ] } ] } Any idea how to fix it?
1 Reply
Martin
MartinOP6mo ago
Thank you for the reply. I tried most of these, as seen in my vercel.json, but none of these work. In posthog it still shows the cloudflare ip. I also added env variables in vercel for TRUST_ALL_PROXIES and IS_BEHIND_PROXY.
Want results from more Discord servers?
Add your server