Skip to content

[Docs] Route Middleware vs Server Middleware Confusion #33642

@onmax

Description

@onmax

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

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions