Hi,
I’ve got an application built using react router v7 framework mode. I’ve deployed it to a render static site. I am using SSG for some routes, and rely on the SPA mode/client-side routing for anything that is not pre-rendered. I am struggling to understand how to setup redirect/rewrites to make this work.
If I don’t specify any rules at all, it works fine for all of my pre-rendered routes. For any route where there is no resource available, naturally I will get 404. This is what I expect. I do however want any route that does not match a pre-rendered resource to be rewritten to ‘/’, so that client-side routing can take over here.
I read in the documentation ( https://render.com/docs/redirects-rewrites#rule-matching-and-ordering ) that any route that matches a resource will not have rewrite rules applied to them, even if there exists a matching rule. This leads me to believe that setting up the a rule from ‘/*’ to ‘/’ (or ‘/index.html’) should do exactly what I want; for any route that has no pre-rendered resource the request is rewritten to ‘/’, and for everything else the pre-rendered resource is served.
This is not what happens though, if I set up the above rule, ALL routes (regardless of if there is a resource there or not) are always rewritten to ‘/’. My pre-rendered resources are never served.
Example: I navigate to ‘/my-route’, there is a resource at ‘/my-route/index.html’. The request is rewritten to ‘/’. I would expect this not to be rewritten, as there is a resource at ‘/my-route’
Am I misunderstanding something in the docs?