From a2572903b9cb96a754148135f7cb8ee37c4fedf5 Mon Sep 17 00:00:00 2001 From: Lawrence Chen Date: Tue, 17 Mar 2026 16:23:58 -0700 Subject: [PATCH 1/3] 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. --- web/middleware.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/middleware.ts b/web/middleware.ts index fcf488a69aa9..c8f37e95f1e3 100644 --- a/web/middleware.ts +++ b/web/middleware.ts @@ -4,5 +4,5 @@ import { routing } from "./i18n/routing"; export default createMiddleware(routing); export const config = { - matcher: ["/((?!api|_next|_vercel|.*\\..*).*)"], + matcher: ["/((?!api|_next|_vercel|cmuxterm|.*\\..*).*)"], }; From aa00c5d4935b5096cf1789766bec566c32f706af Mon Sep 17 00:00:00 2001 From: Lawrence Chen Date: Tue, 17 Mar 2026 16:39:52 -0700 Subject: [PATCH 2/3] 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. --- web/{middleware.ts => proxy.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename web/{middleware.ts => proxy.ts} (100%) diff --git a/web/middleware.ts b/web/proxy.ts similarity index 100% rename from web/middleware.ts rename to web/proxy.ts From 4e6a0b81159b9d72c4a10ee68a66aeb17f555883 Mon Sep 17 00:00:00 2001 From: Lawrence Chen Date: Tue, 17 Mar 2026 16:42:36 -0700 Subject: [PATCH 3/3] 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. --- web/app/[locale]/posthog.tsx | 2 +- web/next.config.ts | 12 ------------ web/proxy.ts | 2 +- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/web/app/[locale]/posthog.tsx b/web/app/[locale]/posthog.tsx index 33d46c4890c9..8c924c3cc757 100644 --- a/web/app/[locale]/posthog.tsx +++ b/web/app/[locale]/posthog.tsx @@ -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, diff --git a/web/next.config.ts b/web/next.config.ts index 1c25cf3d5de2..3ab0db0d1115 100644 --- a/web/next.config.ts +++ b/web/next.config.ts @@ -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); diff --git a/web/proxy.ts b/web/proxy.ts index c8f37e95f1e3..fcf488a69aa9 100644 --- a/web/proxy.ts +++ b/web/proxy.ts @@ -4,5 +4,5 @@ import { routing } from "./i18n/routing"; export default createMiddleware(routing); export const config = { - matcher: ["/((?!api|_next|_vercel|cmuxterm|.*\\..*).*)"], + matcher: ["/((?!api|_next|_vercel|.*\\..*).*)"], };