-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
plugin-client-redirects should allow fully resolved URIs #6845
Comments
Technically we can allow queries and fragments as well. No idea why that isn't the case |
Yes we could allow external URLs @zpao what are you trying to do exactly? This redirect plugin is a best-effort but it's preferable to use server-side redirects if your host supports it (and Netlify/Vercel do), so I'd only recommend this plugin for GitHub Pages users
@Josh-Cena what do you mean here? ?query=string#hash? I don't remember exactly but I think my initial goal 2 years ago was to ensure that the redirect destination exists to prevent possible user mistakes |
Yes, like I think the schema only allowing pathnames for |
That's a good goal, but feels overly prescriptive. People may split sites or things something an need to redirect some parts of content. Do you actually ensure the destination exists or is it just a check that it stays within
Fair! I feel the same, but also wanted something quick to just work, even if hosted on a service that supports it. Another thing worth thinking about is making the plugin the place to store this data and having it generate different output targets. That way switching between gh-pages, netlify, vercel, etc can be a single line change in the docusaurus config. But that's beyond the scope of the issue here (and maybe doesn't fit with the name |
It ensures that it redirects to a valid SPA Docusaurus route afaik but we can remove those restrictions
That's what Gatsby does with its IMHO that's convenient for simple cases, but it can get quite complicated fast, as each host has a different behavior, capabilities, and syntax (edge vs serverless, ability to redirect subdomains, syntax to redirect many subroutes, conditional redirects...) If we do this we should decide on a limited set of supported hosts and abstraction to cover only the most simple cases. I'm not sure it's a good idea to invest time in this abstraction now. Having a good documentation page about redirects (server or client) may be good enough: it's easy to create a |
|
I failed to mention I'm using GitHub Pages. I see it was mentioned that GH Pages doesn't support server-side redirects, hence the need for the redirects plugin. I think this means there's not a way to create arbitrary server-side redirects with Docusaurus + GH Pages unless the redirect's target is internal to the Docusaurus site. |
There is no way (even for internal site links) to add server-side redirects using GitHub Pages (unless they decide to evolve the service). The client-redirect plugin can only create client-redirects. Even if we add a Docusaurus feature some day, it will not support all target platforms (ie GitHub pages), and will have to limit itself to the common ground that most of these platforms support (ie simple redirect syntax with an exhaustive list of from/to URLs). It's quite common to redirect things like |
Just chiming in that we could really us fragments as part of the target for exactly the mentioned use case of combining multiple pages into one. Anything I can do to help? Is it more complicated than making the validation less prescriptive? |
This would be very useful. For example, when adding documentation links to an application it is a good idea to add them as redirects, so the documentation team can manage the links destination without having to update the application. Here's at least a partial solution: efbcedd |
😍 😍 thank you so much @slorber! |
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
It can be useful for several reasons to have redirects off of the website. That requires using a fully resolved URI. While HTTP redirects are generally preferred it's not always an option.
Reproducible demo
No response
Steps to reproduce
Configure plugin-client-redirects with a
to
that includes a fully resolved URI (protocol & domain)Expected behavior
Build succeeds
Actual behavior
Your environment
Self-service
The text was updated successfully, but these errors were encountered: