- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 369
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
redirect to absolute URL not working #1103
Comments
I see, I'll fix it tomorrow. |
Thanks! I just have a question, why is the public API of |
Because you're supposed to use static redirections instead: https://vite-plugin-ssr.com/redirects. Dynamic/conditional redirections and 301 are inherently contradictory. |
|
Actually, there is a bug about it. Let me fix it. |
Pre-released as |
Thanks. I understand, but there are some cases when dynamic 301 redirects are useful. For example, my use case involves always redirecting to the canonical URL for SEO purposes. I always want to maintain a dynamic path and query parameters in a specific order. If a user or bot lands on a page that can be resolved but doesn't match the canonical format, they are permanently redirected to the correct canonical URL. This can't be achieved with static redirections since the route involves a path wildcard and a portion of the path is dynamic. I really appreciate how the VPS remains open and non-restrictive during development. However, recent changes seem to introduce unnecessary restrictions that limit developers' flexibility :-( Regardless, thank you for your awesome work! I'll make an effort to advocate for sponsorship within the company. |
Makes sense, I will unlock dynamic 301 redirects: #1104.
Can you elaborate? |
Done: you can now use
Thanks, I hugely appreciate it. Keep me updated how it goes. Sponsoring makes a big difference for vite-plugin-ssr. Flexibility being one of vite-plugin-ssr's raison d'etre, rest assured that I care about it. I know some decisions seem to suggest otherwise at first, but the vision is very much always also about increasing flexibility. (Let alone because flexibility degradation potentially means breaking existing apps which is a no-go.) Feel free to be cricital and elaborate about any aspect you believe is degrading. |
Awesome, thanks! A few things come to my mind when discussing flexibility:
|
The plan is to eventually remove the unkown status code warning: users will then be able to use any status code simply by doing As for
Do you mind elaborating? |
Thanks for the explanation. Regarding the Here's an example from my resolve: {
alias: [
/**
* Alias # as the project root
*/
{find: '#', replacement: process.cwd()},
/**
* Other library aliases
*/
{find: 'ttag', replacement: isProd ? 'ttag/dist/mock' : 'ttag'},
{find: 'react', replacement: 'preact/compat'},
{find: 'react-dom', replacement: 'preact/compat'},
/**
* Replace all openapi clients' runtime with a single one
*/
{
find: /^(.*)\/runtime$/,
replacement: '$&',
customResolver: function (id, importer) {
if (importer?.match(/node_modules\/@platform\/(.*)\/dist\/esm/)) { // We know it will match the API clients
return './node_modules/@platform/biano-frontend-service-react-api-client/dist/esm/runtime.js';
}
if (importer?.match(/node_modules\/@platform\/(.*)\/dist/)) {
return './node_modules/@platform/biano-frontend-service-react-api-client/dist/runtime.js';
}
if (importer?.match(/node_modules\/@platform\/(.*)\/src/)) {
return './node_modules/@platform/biano-frontend-service-react-api-client/src/runtime.ts';
}
return id;
} as ResolveIdHook,
}
]
} I hope this gives you a rough idea of what it's all about. |
I think it's possible to workaround it. Have a look at virtual modules and Btw. if your company ends up sponsoring then you'll get increased support. I'd also further dig into finding ways to remove the need for vite-plugin-ssr to disambiguate between npm packages and path aliases, so that you can keep using your solution with aliases. (Although, honestly, I think the fact that you're earning money with VPS would be the strongest reason for sponsoring; it just makes sense, let alone to ensure your dependency is well maintained. In my experience, managers care a lot about having happy employees, so that's also an argument since Software Engineers usually appreciate tight-knit companies who can show to be generous towards passionate peers such as open source developers.) |
FYI I did dig into this already: finding alternatives isn't trivial. It may be possible if I invest more time on it. |
Description
Hi, I found a bug while migrating to new
redirect()
from'vite-plugin-ssr/abort'
The signature promises support of relative and absolute urls, but redirection to absolute url crashes the app.
Here is the error stack:
I see the problem in
assertNoInfiniteHttpRedirect
where the checkassert(urlSource.startsWith('/'))
fails.Thanks :-)
The text was updated successfully, but these errors were encountered: