Next.jsIntermediate
Middleware
Run code before every request on the edge — auth checks, redirects, rewrites, A/B testing, and header injection — with sub-millisecond latency and global distribution.
Next.jsMiddlewareEdgeAuth
View on Next.js
Opens official documentation at nextjs.org