mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-08 20:25:19 +02:00
Merge pull request #630 from MODSetter/dev
feat: configure PostHog reverse proxy to bypass ad blockers
This commit is contained in:
commit
c3678e4aed
2 changed files with 25 additions and 1 deletions
|
|
@ -2,7 +2,10 @@ import posthog from "posthog-js";
|
||||||
|
|
||||||
if (process.env.NEXT_PUBLIC_POSTHOG_KEY) {
|
if (process.env.NEXT_PUBLIC_POSTHOG_KEY) {
|
||||||
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY, {
|
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY, {
|
||||||
api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST,
|
// Use reverse proxy to bypass ad blockers
|
||||||
|
api_host: "/ingest",
|
||||||
|
// Required for toolbar and other UI features to work correctly
|
||||||
|
ui_host: "https://us.posthog.com",
|
||||||
defaults: "2025-11-30",
|
defaults: "2025-11-30",
|
||||||
// Disable automatic pageview capture, as we capture manually with PostHogProvider
|
// Disable automatic pageview capture, as we capture manually with PostHogProvider
|
||||||
// This ensures proper pageview tracking with Next.js client-side navigation
|
// This ensures proper pageview tracking with Next.js client-side navigation
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,27 @@ const nextConfig: NextConfig = {
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// PostHog reverse proxy configuration
|
||||||
|
// This helps bypass ad blockers by routing requests through your domain
|
||||||
|
async rewrites() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
source: "/ingest/static/:path*",
|
||||||
|
destination: "https://us-assets.i.posthog.com/static/:path*",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
source: "/ingest/:path*",
|
||||||
|
destination: "https://us.i.posthog.com/:path*",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
source: "/ingest/decide",
|
||||||
|
destination: "https://us.i.posthog.com/decide",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
},
|
||||||
|
// Required for PostHog reverse proxy to work correctly
|
||||||
|
skipTrailingSlashRedirect: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Wrap the config with MDX and next-intl plugins
|
// Wrap the config with MDX and next-intl plugins
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue