fix(analytics): properly forward client IPs to Rybbit and OpenPanel
- Create new API route /api/rybbit/track to proxy Rybbit tracking requests - Extract real client IP from Cloudflare headers (cf-connecting-ip) - Forward X-Forwarded-For and X-Real-IP headers to analytics backends - Update OpenPanel proxy to also forward client IP - Update next.config.ts rewrite to use internal API route This fixes geo-location issues where all traffic appeared to come from Cloudflare edge locations instead of actual visitor countries.
This commit is contained in:
@@ -16,7 +16,7 @@ const nextConfig: NextConfig = {
|
||||
},
|
||||
{
|
||||
source: "/api/track",
|
||||
destination: `${rybbitHost}/api/track`,
|
||||
destination: "/api/rybbit/track",
|
||||
},
|
||||
{
|
||||
source: "/api/site/tracking-config/:id",
|
||||
|
||||
Reference in New Issue
Block a user