Next.jsQuestion 13 of 15
What does Middleware do in Next.js? And what is Proxy?
Answer out loud or in your head first, then compare.
Answer
It's logic that runs before a request is fully handled: it can redirect, rewrite the URL or change headers.
Watch the version: since Next.js 16, Middleware has been renamed to Proxy; you'll see proxy.ts instead of middleware.ts.
Example use: a redirect based on the address, or an early check that a session exists.
Pitfall: hiding a page or redirecting doesn't replace authorisation when data is read and written. Proxy isn't the place for slow data fetching or all of your session handling.
How did it go? Be honest — “Not yet” puts the question on your review list.