-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Closed
Labels
Description
Issue:
The term 'middleware' is used to describe two completely different concepts in the documentation, which causes confusion about the scope and execution context.
Problem
Users may expect route middleware (app/middleware/) to affect API routes, but in fact it only runs when navigating pages via Vue Router. Server middleware (server/middleware/) handles API requests.
Current documentation
- Route middleware: https://nuxt.com/docs/4.x/getting-started/routing#route-middleware
- Server middleware: https://nuxt.com/docs/4.x/guide/directory-structure/server#server-middleware
Both use the term "middleware", but:
- Route middleware: Client-side navigation guards (Vue Router); affects pages only.
- Server middleware: Server-side request handlers (Nitro); affects all HTTP, including /api.
Suggestion
Add an explicit callout to the route middleware documentation.
Note: Route middleware only runs during page navigation. It does not affect '/api' routes or server requests. Use server middleware to intercept API requests.
Please let me know if I have misunderstood something.