T
TanStack6mo ago
mere-teal

How does URL rewrite work in Tanstack query?

I have updated my app.config.ts file with nitro config to rewrite / to /home app.config.ts
routeRules: {
"/": {
proxy: {
to: "/home"
}
}
}
routeRules: {
"/": {
proxy: {
to: "/home"
}
}
}
But because / route does not exist, whenever I visit / i get a flash of /home before getting the 404 view
4 Replies
other-emerald
other-emerald6mo ago
what's your definition of "rewrite" ?
mere-teal
mere-tealOP6mo ago
I'm trying to proxy a request to a page to another page. Here's an example of how it's done in next.js https://nextjs.org/docs/app/api-reference/config/next-config-js/rewrites
next.config.js: rewrites | Next.js
Add rewrites to your Next.js app.
other-emerald
other-emerald6mo ago
we don't support rewriting routes yet in that way in your config, tanstack router is not aware that this rewrite is happening and thus cannot take it into account we will add some API to do this in router in the future
mere-teal
mere-tealOP6mo ago
Ok, noted. Will keep an eye out for the update

Did you find this page helpful?