Docs: Multiple middleware #74765
jake-normal
started this conversation in
Ideas
Replies: 1 comment
-
@jake-normal I don't think this is implying that you can have more than one Middleware file—it is instead implying you can import your modular "middleware logic" into your single Middleware file. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What is the documentation issue?
https://nextjs.org/docs/app/building-your-application/routing/middleware#convention
Is there any context that might help us understand?
The documentation contains the following statement:
The docs seem to imply that the mere act of importing multiple files exporting a
middleware
andconfig
object is enough to use multiple middleware. But I imagine there is actually a composition step missing. Obviously middleware can be composed with function composition, but what isn't clear is how to combine multipleconfig
objects and matchers, that is, to ensure that each middleware is associated with a given matcher.Can we get an example of importing more than one middleware, each with its own matcher config?
Does the docs page already exist? Please link to it.
No response
Beta Was this translation helpful? Give feedback.
All reactions