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

Inconsistent route priority with rest parameters and configured redirects #8129

Closed
1 task
Hoolean opened this issue Aug 18, 2023 · 4 comments
Closed
1 task
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) feat: redirects Related to the redirects feature (scope)

Comments

@Hoolean
Copy link

Hoolean commented Aug 18, 2023

What version of astro are you using?

2.10.9

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

npm

What operating system are you using?

Linux

What browser are you using?

Describe the Bug

Hello!

When a project has both rest parameters and configured redirects, the route priority is inconsistent across paths of different depths.

More specifically, single-layer paths will prioritise configured redirects, whereas multi-layer paths will prioritise rest parameters.

e.g. With pages:

  • src/
    • pages/
      • [...path].astro
      • redirected.astro

...and configured redirects:

  • /abc/redirected
  • /abc/def/redirected

...then /abc will be serve [...path].astro and /abc/def will serve redirected.astro.

What's the expected result?

The rest parameter would be prioritised in both cases or the configured redirect would be prioritised in both cases.

e.g.
Either:

  • Both /abc and /abc/def will serve [...path.astro]; or
  • Both /abc and /abc/def will serve redirected.astro.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/astro-inconsistent-route-priority

Participation

  • I am willing to submit a pull request for this issue.
@natemoo-re natemoo-re added - P4: important Violate documented behavior or significantly impacts performance (priority) feat: redirects Related to the redirects feature (scope) labels Aug 18, 2023
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Aug 18, 2023
@natemoo-re natemoo-re removed the needs triage Issue needs to be triaged label Aug 18, 2023
@rishi-raj-jain
Copy link
Contributor

I'd like to attempt this.

@natemoo-re How's this a redirect issue? The pages at redirect generate a redirect to the slug mentioned with the destination URL. I think route priority in general needs to be fixed?

@rishi-raj-jain
Copy link
Contributor

rishi-raj-jain commented Sep 23, 2023

Okay, so I played with it a little bit. It only seems to occur in mode: 'server' and whenever there's a redirect in place. @ematipico Any good point of reference for me to start at to contribute to this?

@florian-lefebvre
Copy link
Member

I believe this will be fixed by #9439

@ematipico
Copy link
Member

Going to close, I'm pretty sure this is fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) feat: redirects Related to the redirects feature (scope)
Projects
None yet
Development

No branches or pull requests

5 participants