cmux/web/proxy.ts
Lawrence Chen 93d2245a97
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>
2026-03-17 17:02:42 -07:00

8 lines
217 B
TypeScript

import createMiddleware from "next-intl/middleware";
import { routing } from "./i18n/routing";
export default createMiddleware(routing);
export const config = {
matcher: ["/((?!api|_next|_vercel|.*\\..*).*)"],
};