Next.js Discord

Discord Forum

skipMiddlewareUrlNormalize only on some routes

Arboreal ant posted this in #help-forum
Open in Discord
Arboreal antOP
What's the best way to run the normalize url middleware only on some routes? I wanted to enable skipMiddlewareUrlNormalize and run a function that normalizes the url manually in my middleware on all routes but one specific route where I need the normalization disabled. Actually I only need the handling (removal of the language slug) stopped on this route. The problem is - from my understanding of a quick check of the nextjs code - that the parameter skipMiddlewareUrlNormalize is used in so many places (including webpack). It might be easier to let the normalize middleware do it's job and try to find a solution for the one route that should not be normalized. Any ideas?

0 Replies