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

Wildcard routes can have the wrong priority order in @astrojs/netlify _redirects config #8121

Closed
1 task done
tony-sull opened this issue Aug 17, 2023 · 1 comment
Closed
1 task done
Labels
needs triage Issue needs to be triaged

Comments

@tony-sull
Copy link
Contributor

What version of astro are you using?

2.10.9

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

Netlify

What package manager are you using?

pnpm

What operating system are you using?

Mac

What browser are you using?

Firefox

Describe the Bug

Looks like there's a corner case in routing priority order, specifically with the sort order of wildcard routes when building for Netlify. This was introduced sometime after @astrojs/netlify@2.1.3, upgrading to latest ran into this bug

With the file structure below,

pages
├─ [slug].astro
├─ themes
       ├─ [...page].astro

the build dist/_redirects file ends up with redirects in the wrong order (below)

/:slug                    /:slug/index.html                   200
/themes/*             /.netlify/functions/entry           200

With this order, Netlify will match a request to /themes with the static /:slug fallback instead of the more specific /themes/* route.

What's the expected result?

The redirects should be order should be flipped so that the /themes/[...page] takes priority

/themes/*             /.netlify/functions/entry           200
/:slug                    /:slug/index.html                   200

Link to Minimal Reproducible Example

na

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Aug 17, 2023
@natemoo-re
Copy link
Member

I fairly sure this is a duplicate of #8121 so I'm going to move this convo over there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants