Replies: 3 comments
-
Similar RFCs/docs from other frameworks: Astro Remix
SvelteKit And a pretty nice post that explores the feature in various frameworks: |
Beta Was this translation helpful? Give feedback.
-
Rakkas' route guards docs which support rewriting https://rakkasjs.org/guide/route-guards |
Beta Was this translation helpful? Give feedback.
-
A potentially easier first step to get to a type-safe solution is to go for a config-driven solution, similar to Next.js rewrites. This can be configured in the Vite plugin. With these rewrites, you can do most of the dynamic rewriting, especially if you make it an async function that is invoked within the loaders lifecycle. Would be great for setting up reverse proxies for ingestion endpoints (Posthog, Sentry, etc) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Flexible rewrites similar to NextJS'
NextResponse.rewrite
which helps many SaaS developers offer multi tenant and dynamic platforms. The goal is to provide developers with a powerful tool to dynamically modify routing behavior based on various conditions, such as hostnames, paths, or custom logic.As it stands, there's no simple way to include multi-tenancy/ custom domain routing / or conditional path rewrites for those building such applications. And it's been agreed across the board that NextJS have the upper hand on this. By introducing a built-in rewrite mechanism that can be added within middleware, this should break down a lot of walls.
The proposal is for a
rewrite
option to the TanStack Router/Start configuration. This option would allow developers to define rules for rewriting routes based on various conditions.A great example would be the Vercel Multi-tenant template they provide. Example
Another reference would be the NextResponse documentation
So, if
redirect
works like this:rewrite
could work like this:Beta Was this translation helpful? Give feedback.
All reactions