Skip to content
Advertisement

middleware.js in nextjs doesn’t work at all

JavaScript

(Next v.12.2.3) No matter what I code, pages/middleware.js seems not running at all!

I wanna redirect uppercase urls to lowercase urls.

what should I do?

Advertisement

Answer

The documentation says:

Create a middleware.ts (or .js) file at the same level as your pages directory

So it shouldn’t be inside pages/, but in the same directory as pages/.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement