Repository navigation
Conversation
Next.js 16 deprecated the `middleware.ts` convention in favour of `proxy.ts`. We kept the old one because OpenNext's Cloudflare adapter only supported Edge middleware, and `proxy.ts` always runs on the Node.js runtime. `@opennextjs/cloudflare@1.20.3` added support for Node.js middleware, so this bumps it to the latest release and renames the file. next-intl has no `proxy` entry point; `createMiddleware` from `next-intl/middleware` is still the API to use, so the code itself doesn't change. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9215 +/- ##
==========================================
- Coverage 86.04% 86.02% -0.02%
==========================================
Files 86 86
Lines 6075 6075
Branches 361 361
==========================================
- Hits 5227 5226 -1
- Misses 844 845 +1
Partials 4 4 ☔ View full report in Codecov by Harness. |
There was a problem hiding this comment.
🟡 Changes recommended
The updated adapter’s required Next.js and Wrangler peer versions are not satisfied.
1 open finding
What changed in this PR
Renames the locale middleware to Next.js 16’s proxy.ts convention and updates Cloudflare support.
Changes:
- Renames middleware references to proxy.
- Updates OpenNext Cloudflare and transitive dependencies.
- Updates ownership and documentation references.
| File | Description |
|---|---|
apps/site/proxy.ts |
Updates proxy terminology. |
platforms/cloudflare/package.json |
Bumps OpenNext Cloudflare. |
pnpm-lock.yaml |
Updates resolved dependencies. |
.github/CODEOWNERS |
Updates the owned proxy path. |
docs/technologies.md |
Corrects the locale-routing filename. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| "dependencies": { | ||
| "@flarelabs-net/wrangler-build-time-fs-assets-polyfilling": "^0.0.1", | ||
| "@opennextjs/cloudflare": "^1.20.2", | ||
| "@opennextjs/cloudflare": "^1.20.10", |
📦 Build Size ComparisonSummary
|

Description
This PR renames
apps/site/middleware.tstoapps/site/proxy.ts, following the Next.js 16proxy.tsfile convention.We stuck with
middleware.tsbecauseproxy.tsalways runs on the Node.js runtime, and OpenNext's Cloudflare adapter only supported Edge middleware. That changed in@opennextjs/cloudflare@1.20.3(opennextjs/opennextjs-cloudflare#1309), so this also bumps it from^1.20.2to^1.20.10. The same release has opennextjs/opennextjs-cloudflare#1359, which we need too since we register an instrumentation hook: without it every request going through a Node.js middleware fails on workerd withDynamic require of ".next/server/instrumentation.js" is not supported.The proxy's code itself doesn't change. next-intl has no
next-intl/proxyentry point (not even on the latest 4.14.9), socreateMiddlewarefromnext-intl/middlewareis still the API to use. Besides that:CODEOWNERSnext.middleware.jsreference indocs/technologies.mdThe extra churn in
pnpm-lock.yamlis OpenNext's own dependency tree (@opennextjs/aws4.1.0 → 4.1.9).Note
OpenNext warns during the build that Node.js middleware support on Cloudflare is experimental and not officially maintained by the OpenNext maintainers. Our proxy only runs on
/to redirect to the preferred locale, so the blast radius is small, but it's something to keep an eye on.Validation
turbo build --filter=@node-core/platform-cloudflarepasses: Next.js listsƒ Proxy (Middleware)and OpenNext bundles it as a Node.js middleware.wrangler devand requested/with differentAccept-Languageheaders:fr→ 307/fr,es→ 307/es,de(disabled locale) and no header → 307/en./enand/fr/aboutreturn 200, and there are no errors in the worker logs.pnpm test, ESLint, Prettier andtscpass locally, andchangeset statusis clean since both touched packages are private.Vercel supports
proxy.tsnatively on Next.js 16, so the Vercel preview on this PR should confirm that side. Static export builds aren't affected, Next.js treatsproxy.tsthere the same way it treatedmiddleware.ts.Related Issues
N/A
Check List
pnpm formatto ensure the code follows the style guide.pnpm testto check if all tests are passing.pnpm buildto check if the website builds without errors.