Proxy and request interception
Proxy runs before a matching route and is useful for request-level decisions. It should stay thin.
Think of Proxy as a request gate, not your application layer
Modern Next.js uses the Proxy convention for work that happens before a request reaches the route. Older material may call the same broad concept middleware.
Good uses include redirects, rewrites, lightweight header changes, and routing decisions that genuinely need to happen before rendering.
Where Proxy sits
A redirect is not an authorisation boundary
Proxy can improve navigation by redirecting obviously unauthenticated requests, but protected data still needs server-side permission checks close to the operation that reads or changes it.
Other entry points may reach the same data without going through the UI path you had in mind.
Keep it cheap
Code in the request path runs often. Avoid turning Proxy into a second application with database-heavy business logic and complicated branching.
If a decision can happen safely inside the route or data-access layer, that is often easier to test and maintain.
Can you explain “Proxy and request interception” without reaching for the API reference?
Describe the main trade-off, one failure mode, and the decision you would make in a real project.