Next.js renames middleware to proxy, showcases 22-line implementation
Next.js 16 has deprecated the 'middleware' file convention and renamed it to 'proxy'. The change requires developers to rename their middleware files and export functions accordingly. The article presents a 22-line proxy implementation that handles CORS for API routes and refreshes user authentication sessions. A key configuration uses a regex matcher to exclude static assets and webhook routes from proxy processing for efficiency and correctness.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in