Skip to content
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

Allow glob pattern in routeRules #2443

Open
krehak opened this issue May 14, 2024 · 0 comments
Open

Allow glob pattern in routeRules #2443

krehak opened this issue May 14, 2024 · 0 comments

Comments

@krehak
Copy link

krehak commented May 14, 2024

Environment

nitro v2.9.6
node v22.0.0
npm v10.5.1

Reproduction

Try to create a redirect or something for certain type of files

Describe the bug

So this is what I have in my config:

routeRules: {
  '/somewhere.js': {
    redirect: '/somewhere-else',
  },
},

This works fine, when I visit "somewhere.js" I got redirected. But If I want it to make it global, like this:

routeRules: {
  '/**.js': {
    redirect: '/somewhere-else',
  },
},

It simply doesn't work. What I tried: /**.js, /*.js, **.js, *.js, **/**.js. I also tried to add \ and \\ in front of the dot, but same results.

What kind of glob is used in the pattern? I didn't find in the docs information how to make custom routes for assets.

Additional context

No response

Logs

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant