H3 · H30020

Match nested paths in H3 v2 middleware

Flags app.use("/path", middleware) with a path that has no wildcard. Mounting a sub-app with app.use("/path", app) still matches nested paths and is not flagged.
H30020vite-doctor/h3middlewarewarnSuggestion

Run this rule

pnpm vite-doctor . --extends auto,h3/strict --rules h3/middleware/no-exact-path-use

Why it matters

In H3 v1, app.use("/api", fn) ran for every path under /api. In H3 v2 a middleware path is a route pattern, so "/api" matches only /api itself and the middleware skips every nested route.

Add a wildcard, such as app.use("/api/**", fn), or keep the exact path when the middleware is meant for that one route.

Example

Match nested paths with a wildcard

Before

app.use("/api", auth)

After

app.use("/api/**", auth)
Copyright © 2026