Skip to content

The Open Source DocuSign Alternative.

feat: add posthog reverse proxy (#449)

David Nguyen7ec8ce2a5622
diff --git a/apps/marketing/next.config.js b/apps/marketing/next.config.js
index e74f7d545..aeb06bdfd 100644
--- a/apps/marketing/next.config.js
+++ b/apps/marketing/next.config.js
@@ -56,6 +56,14 @@ const config = {
},
];
},
+ async rewrites() {
+ return [
+ {
+ source: '/ingest/:path*',
+ destination: 'https://eu.posthog.com/:path*',
+ },
+ ];
+ },
};
module.exports = withContentlayer(config);
diff --git a/apps/web/next.config.js b/apps/web/next.config.js
index c4359060b..b9e5d2517 100644
--- a/apps/web/next.config.js
+++ b/apps/web/next.config.js
@@ -29,6 +29,14 @@ const config = {
transform: 'lucide-react/dist/esm/icons/{{ kebabCase member }}',
},
},
+ async rewrites() {
+ return [
+ {
+ source: '/ingest/:path*',
+ destination: 'https://eu.posthog.com/:path*',
+ },
+ ];
+ },
};
module.exports = config;
diff --git a/packages/lib/constants/feature-flags.ts b/packages/lib/constants/feature-flags.ts
index e23f59eba..e972b47c2 100644
--- a/packages/lib/constants/feature-flags.ts
+++ b/packages/lib/constants/feature-flags.ts
@@ -1,3 +1,5 @@
+import { APP_BASE_URL } from './app';
+
/**
* The flag name for global session recording feature flag.
*/
@@ -23,7 +25,7 @@ export const LOCAL_FEATURE_FLAGS: Record<string, boolean> = {
*/
export function extractPostHogConfig(): { key: string; host: string } | null {
const postHogKey = process.env.NEXT_PUBLIC_POSTHOG_KEY;
- const postHogHost = process.env.NEXT_PUBLIC_POSTHOG_HOST;
+ const postHogHost = `${APP_BASE_URL}/ingest`;
if (!postHogKey || !postHogHost) {
return null;