Question
Server middleware execution timing unclear in Nuxt 3
Cig Byte
0 reputation · 30 May 2021, 11:51 UTC
136.3K views0
Goal: ensure that custom server‑side logic in Nuxt 3 server middleware runs before the page component renders so that date‑timezone conversion can be applied to incoming requests.
Uncertainty: it is not documented whether middleware defined under server/middleware is guaranteed to execute before the Nuxt rendering pipeline when exposeRoute is set to false, nor how its order relates to other nitro route handlers.
- Does Nuxt 3 always invoke server/middleware handlers before rendering the page component, regardless of exposeRoute settings?
- If exposeRoute: false is used, does the middleware still run on every request?
- How can the execution order be confirmed without altering the rendering output?