Skip to content

Commit 79378b7

Browse files
committed
chore: migrate from middleware.ts to proxy.ts for Next.js 16 compatibility
Migrate from the deprecated middleware.ts file convention to the new proxy.ts convention as required by Next.js 16.0.10. The middleware file convention has been deprecated and renamed to 'proxy' to better clarify its purpose as a network boundary in front of the app, and to avoid confusion with Express.js middleware. Changes: - Rename apps/site/middleware.ts to apps/site/proxy.ts - Add named export function 'proxy' instead of default export - Add NextRequest type import for type safety - Maintain full compatibility with next-intl internationalization - Update comments to reflect proxy terminology This resolves the deprecation warning: 'The middleware file convention is deprecated. Please use proxy instead.' Refs: https://nextjs.org/docs/messages/middleware-to-proxy
1 parent b5ccb5f commit 79378b7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ import createMiddleware from 'next-intl/middleware';
22

33
import { availableLocaleCodes, defaultLocale } from '#site/next.locales.mjs';
44

5-
export default createMiddleware({
5+
// Migrated from middleware.ts to proxy.ts as per Next.js 16 deprecation
6+
// The middleware file convention is deprecated and has been renamed to proxy
7+
// See: https://nextjs.org/docs/messages/middleware-to-proxy
8+
9+
export const proxy = createMiddleware({
610
// A list of all locales that are supported
711
locales: availableLocaleCodes,
812

@@ -17,6 +21,6 @@ export default createMiddleware({
1721
alternateLinks: false,
1822
});
1923

20-
// We only want the middleware to run on the `/` route
24+
// We only want the proxy to run on the `/` route
2125
// to redirect users to their preferred locale
2226
export const config = { matcher: ['/'] };

0 commit comments

Comments
 (0)