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:
Unchained
2026-04-01 07:42:34 +02:00
parent a3873bb50d
commit 0b9ddeedc8
10 changed files with 169 additions and 338 deletions

View File

@@ -53,7 +53,7 @@ export default async function LocaleLayout({
<Script
src="/api/script.js"
data-site-id={RYBBIT_SITE_ID}
strategy="lazyOnload"
strategy="afterInteractive"
/>
<NextIntlClientProvider messages={messages}>
{children}