Security
Request Proxy
MuseMVP uses a single Next.js proxy.ts entry for locale routing.
MuseMVP uses src/proxy.ts as the only Next.js request entry. Locale routing stays there, and auth decisions stay in layouts, pages, and the API.
Why proxy.ts
- Next.js 16 and OpenNext Cloudflare 1.20 both accept
proxy.ts. The template no longer keeps a second request entry. - The entry only handles request shape: locale routing, rewrite or redirect, and the static
matcher. It does not decide sessions or roles. - One file removes the old EdgeOne filename switch between
middleware.tsandproxy.ts.
Boundary
Keep request-shape work in proxy.ts. Auth state and business redirects belong in layout, page, or server logic.
OpenNext
OpenNext still marks Node.js middleware bundling as experimental. The template ships proxy.ts because that is the entry OpenNext 1.20.3 and later can bundle.