-
Notifications
You must be signed in to change notification settings - Fork 3.5k
fix(analytics): add posthog ingest proxy and document env vars #3915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -417,6 +417,14 @@ const nextConfig: NextConfig = { | |
| source: '/r/:shortCode', | ||
| destination: 'https://go.trybeluga.ai/:shortCode', | ||
| }, | ||
| { | ||
| source: '/ingest/static/:path*', | ||
| destination: 'https://us-assets.i.posthog.com/static/:path*', | ||
| }, | ||
| { | ||
| source: '/ingest/:path*', | ||
| destination: 'https://us.i.posthog.com/:path*', | ||
| }, | ||
|
Comment on lines
+421
to
+427
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
PR #3187 ( When In short, the new rewrites are dead code. If they were ever made to execute (e.g., if the route handler is later removed or if a future Next.js version changes precedence), they would silently regress the intentional improvements from #3187: request bodies may not stream reliably, and auth/session cookies would be forwarded to PostHog rather than stripped. Consider removing these two rewrite entries to avoid confusion and keep the proxy logic consolidated in the route handler. |
||
| ] | ||
| }, | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New rewrite rules are dead code due to existing route
Low Severity
The new
/ingestrewrite rules will never be reached because an existing App Router route handler atapp/ingest/[[...path]]/route.tsalready handles all/ingest/*requests. Next.js evaluates filesystem routes (including API route handlers) before flat-array rewrites, so the optional catch-all route always takes precedence. These rewrites are effectively dead code and duplicate the proxy logic already implemented in the route handler.