unjs / nitro

Next Generation Server Toolkit. Create web servers with everything you need and deploy them wherever you prefer.
https://nitro.unjs.io
MIT License
5.59k stars 482 forks source link

Caching with Nitro `routeRules` breaks server/routes #2140

Open AndersCV opened 5 months ago

AndersCV commented 5 months ago

Environment


Reproduction

https://stackblitz.com/edit/nuxt-starter-ftdurl

Describe the bug

I have a routeRules defined in my nuxt.config.ts like this: routeRules: { '/uk/some-random-slug': { swr: true }, },

I have a server/route like this: server/routes/[locale]/verify-email.ts

Now accessing my server/route at: uk/verify-email does not work de/verify-email works fine

Even though my routeRule is a named route it still conflicts with my server route causing it to return the incorrect data. If you disable caching it works again.

Additional context

No response

Logs

No response

AndersCV commented 5 months ago

Is there any chance someone can take a look at this? Maybe I'm doing something wrong but I doubt this is the intended functionality.