-
-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Middleware enhancements after new Next.js middleware architecture #1362
Comments
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Seems like there's some movement here: vercel/next.js#70961. As far as I understand the feature, it's mostly targeted at validation. The best I can think of is a validation that the From a first glance, the new interceptors feature currently doesn't look like it could help with the pain points that were mentioned above. I'll keep an eye on it though. |
Next-intl's middleware must be the first one that produces the response to work properly. It won't use response produced by the others even if does not do any redirects. It makes way harder to make it work with any middlewares composer. I've built a clunky solution which has one huge limitation - next-intl middleware must be always first in chain. Other middlewares just append some stuff to the generated response. Accepting optional NextResponse as argument in next-intl's middleware could solve. Not sure if anyone else would like to use it xD Even the docs see here somewhere in between states that this middleware is the only one that should produce the happy path response. Do you have any thoughts on that? Maybe i may solve that differently or you can propose some more extensible solutions in next-intl middleware. |
I getting in the same gotcha as @Kuchasz. The current next-intl isn't chain-able easily. If possible it could be a good idea to improve this as next.js push us to use more and more the middleware. |
Is your feature request related to a problem? Please describe.
It seems like there's work happening on the Next.js side on a middleware revamp: vercel/next.js#46722 (comment)
I'm using this thread to collect aspects about the current
next-intl
middleware that we could potentially address in case a revamp is relevant after the Next.js change.Describe the solution you'd like
My personal wishlist for Next.js:
locale
to the rendering phase (see Reading params deeply in Server Components (e.g. for i18n / multi-tenancy) vercel/next.js#58862). Ideally this would be possible without a middleware in the first place though.Mentioned both here.
Separately from this, there are some use cases we could support better that do not rely on Next.js:
We can make these changes in any case, but in case a refactoring is necessary after the Next.js change, maybe it'd be worth waiting a bit.
The text was updated successfully, but these errors were encountered: