Что сказать
«Middleware — single root function before cache на matched requests, Edge runtime — no DB, no Node built-ins, milliseconds budget. Perfect redirects, rewrites, header stamping — bounce logged-out user off static page без dynamic render page. Deliberate scope: optimistic UX — session cookie, JWT verify — re-authorize в Server Component/Action с data. Middleware не security boundary; spoofed header мог skip. Tight matcher — иначе fires на static chunks и taxes site.»
Итог
Middleware pitch: Edge UX gate + re-auth at data layer + tight matcher.