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:
Lawrence Chen 2026-03-17 17:02:42 -07:00 committed by GitHub
parent 43d1fd419e
commit 93d2245a97
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 1 additions and 13 deletions

View file

@ -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,

View file

@ -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);