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

feat(routeRules): allow wildcard redirects #1976

Merged
merged 2 commits into from
Feb 27, 2024
Merged

feat(routeRules): allow wildcard redirects #1976

merged 2 commits into from
Feb 27, 2024

Conversation

JaZo
Copy link
Contributor

@JaZo JaZo commented Dec 1, 2023

πŸ”— Linked issue

#1748

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR adds support for wildcard redirects in routeRules:

  routeRules: {
    '/wildcard/**': { redirect: { to: '/wildcard-2/**', statusCode: 301 } },
  },

It also keeps query parameters, just like the proxy does.

Resolves #1748.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@manniL
Copy link
Contributor

manniL commented Dec 8, 2023

This is a good start! But we also need to add custom rules here for Netlify/Vercel/... redirect files πŸ€”

@JaZo
Copy link
Contributor Author

JaZo commented Dec 13, 2023

Ahh the presets, yes! Forgot about them as we don't use any of those. I'll see if I can add this, but that will probably take a while.

@pi0
Copy link
Member

pi0 commented Dec 13, 2023

Good point regarding platform support. It is not necessary however we can iterate and support it later in the future as mainly nitro server should be able to (universally) catch any platform-unsupported patteren.

@pi0 pi0 changed the title feat: allow wildcard redirects feat(routeRules): allow wildcard redirects Dec 13, 2023
@manniL
Copy link
Contributor

manniL commented Dec 13, 2023

@pi0 I agree. Happy to add it later and let nitro handle it for now πŸ‘πŸ»

@Anoesj

This comment was marked as off-topic.

@JaZo
Copy link
Contributor Author

JaZo commented Jan 28, 2024

I've added examples to the documentation, added tests and implemented Netlify and Vercel as these tests failed!

Copy link
Contributor

nuxt-studio bot commented Jan 28, 2024

βœ… Live Preview ready!

Name Edit Preview Latest Commit
nitro Edit on Studio β†—οΈŽ View Live Preview 521114d

@pi0 pi0 merged commit d937b30 into nitrojs:main Feb 27, 2024
4 checks passed
@pi0
Copy link
Member

pi0 commented Feb 27, 2024

Thanks for quality changes ❀️

@JaZo JaZo deleted the feature/redirect-wildcards branch February 27, 2024 17:59
@pi0 pi0 mentioned this pull request Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wildcard redirects
4 participants