nitrojs / nitrojs/nitro

Wildcard redirects not working. Redirecting to **

Open
#3,303 7 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug nuxt nuxt reproduction v2
Dominant language
TypeScript
Stars
11.2k
Forks
899
Avg merge
2d 24m
Merged PRs (30d)
40

Description

Environment
> nuxi dev --host
node -v v20.14.0
Nuxt 3.16.2 with Nitro 2.11.8    
Reproduction

https://stackblitz.com/edit/nuxt-starter-6g4g6thz?file=app.vue

You have to click the links and see the URL showing on the 404 page.
With routeRules set in nuxt config the url should end with example but it ends with **

Image

Describe the bug
 routeRules: {
    '/brands': { redirect: domain + 'info/brands' },
    '/brands/**': { redirect: { to: '/info/brands/**', statusCode: 301 } }
  },

http://127.0.0.1:3000/brands/example
redirects to
http://127.0.0.1:3000/info/brands/**

Additional context

https://github.com/nitrojs/nitro/issues/1748

Logs

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked StackBlitz reproduction and the routeRules configuration shown in the issue, then trace how the wildcard redirect from /brands/** is handled. Verify the redirect preserves the path segment instead of returning a literal **, and add a regression test for /brands/example before confirming the URL ends in /info/brands/example.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxt, typescript
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.