fix(web): exclude PostHog proxy from i18n middleware (#1626)
* fix(web): exclude PostHog proxy path from i18n middleware
The next-intl middleware added in cf75da8f intercepts /cmuxterm/* requests
(the PostHog reverse proxy), causing analytics to break since March 12.
Add cmuxterm to the negative lookahead so proxy requests bypass i18n.
* refactor(web): rename middleware.ts to proxy.ts for Next.js 16
Next.js 16 renamed middleware.ts to proxy.ts. Migrate to the new
convention since we're on Next.js 16.1.6.
* feat(web): migrate PostHog to managed reverse proxy at r.cmux.dev
Replace the Next.js rewrites-based proxy (/cmuxterm -> us.i.posthog.com)
with PostHog's managed reverse proxy at r.cmux.dev. This removes the
rewrites from next.config.ts entirely and eliminates the proxy.ts
matcher conflict that caused the analytics regression.
---------
Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>
This commit is contained in:
parent
43d1fd419e
commit
93d2245a97
3 changed files with 1 additions and 13 deletions
|
|
@ -7,7 +7,7 @@ import { useEffect, Suspense } from "react";
|
|||
|
||||
if (typeof window !== "undefined") {
|
||||
posthog.init("phc_opOVu7oFzR9wD3I6ZahFGOV2h3mqGpl5EHyQvmHciDP", {
|
||||
api_host: "/cmuxterm",
|
||||
api_host: "https://r.cmux.dev",
|
||||
ui_host: "https://us.posthog.com",
|
||||
person_profiles: "identified_only",
|
||||
capture_pageview: false,
|
||||
|
|
|
|||
|
|
@ -15,18 +15,6 @@ const nextConfig: NextConfig = {
|
|||
},
|
||||
],
|
||||
},
|
||||
async rewrites() {
|
||||
return [
|
||||
{
|
||||
source: "/cmuxterm/static/:path*",
|
||||
destination: "https://us-assets.i.posthog.com/static/:path*",
|
||||
},
|
||||
{
|
||||
source: "/cmuxterm/:path*",
|
||||
destination: "https://us.i.posthog.com/:path*",
|
||||
},
|
||||
];
|
||||
},
|
||||
};
|
||||
|
||||
export default withNextIntl(nextConfig);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue