- 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.
71 lines
1.7 KiB
TypeScript
71 lines
1.7 KiB
TypeScript
import createNextIntlPlugin from "next-intl/plugin";
|
|
import type { NextConfig } from "next";
|
|
|
|
const withNextIntl = createNextIntlPlugin();
|
|
|
|
const nextConfig: NextConfig = {
|
|
output: 'standalone',
|
|
async rewrites() {
|
|
const rybbitHost = process.env.NEXT_PUBLIC_RYBBIT_HOST || "https://rybbit.nodecrew.me";
|
|
return [
|
|
{
|
|
source: "/api/script.js",
|
|
destination: `${rybbitHost}/api/script.js`,
|
|
},
|
|
{
|
|
source: "/api/track",
|
|
destination: "/api/rybbit/track",
|
|
},
|
|
{
|
|
source: "/api/site/tracking-config/:id",
|
|
destination: `${rybbitHost}/api/site/tracking-config/:id`,
|
|
},
|
|
{
|
|
source: "/api/replay.js",
|
|
destination: `${rybbitHost}/api/replay.js`,
|
|
},
|
|
{
|
|
source: "/api/session-replay/record/:id",
|
|
destination: `${rybbitHost}/api/session-replay/record/:id`,
|
|
},
|
|
];
|
|
},
|
|
images: {
|
|
formats: ["image/avif", "image/webp"],
|
|
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048],
|
|
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
|
|
remotePatterns: [
|
|
{
|
|
protocol: "https",
|
|
hostname: "manoonoils.com",
|
|
pathname: "/**",
|
|
},
|
|
{
|
|
protocol: "https",
|
|
hostname: "minio-api.nodecrew.me",
|
|
pathname: "/**",
|
|
},
|
|
{
|
|
protocol: "https",
|
|
hostname: "api.manoonoils.com",
|
|
pathname: "/**",
|
|
},
|
|
{
|
|
protocol: "https",
|
|
hostname: "**.saleor.cloud",
|
|
pathname: "/**",
|
|
},
|
|
{
|
|
protocol: "https",
|
|
hostname: "images.unsplash.com",
|
|
pathname: "/**",
|
|
},
|
|
],
|
|
},
|
|
experimental: {
|
|
optimizePackageImports: ["lucide-react", "framer-motion", "clsx", "motion"],
|
|
},
|
|
};
|
|
|
|
export default withNextIntl(nextConfig);
|