fix(analytics): connect directly to Rybbit to preserve real visitor IP
Some checks failed
Build and Deploy / build (push) Has been cancelled
Some checks failed
Build and Deploy / build (push) Has been cancelled
Changed Rybbit script loading from server-side rewrite to client-side direct connection. This prevents Next.js from proxying the request, which was causing all visitor IPs to show as the Hetzner server IP (138.201.11.251). Before: - Browser → Next.js → Rybbit (server-side proxy, loses client IP) After: - Browser → Rybbit (direct connection, real IP preserved) Changes: - layout.tsx: Use direct Rybbit URL for script src - next.config.ts: Remove /api/script.js rewrite
This commit is contained in:
@@ -34,10 +34,8 @@ const nextConfig: NextConfig = {
|
||||
async rewrites() {
|
||||
const rybbitHost = process.env.NEXT_PUBLIC_RYBBIT_HOST || "https://rybbit.nodecrew.me";
|
||||
return [
|
||||
{
|
||||
source: "/api/script.js",
|
||||
destination: `${rybbitHost}/api/script.js`,
|
||||
},
|
||||
// Note: /api/script.js now connects directly to Rybbit (client-side)
|
||||
// to preserve real visitor IP instead of proxying through Next.js
|
||||
{
|
||||
source: "/api/track",
|
||||
destination: "/api/rybbit/track",
|
||||
|
||||
Reference in New Issue
Block a user