solid-router without SSR and without having to redirect
I just found out that when i build my app with solid-router its only possible to visit the index page on first page load. I saw the section in the readme.
When deploying applications that use a client side router that does not rely on Server Side Rendering you need to handle redirects to your index page so that loading from other URLs does not cause your CDN or Hosting to return not found for pages that aren't actually there.I havent anticipated that and i need the users to visit a specific route of my app (as it is possible in vite dev mode) . Do i need do use server rendering and solidstart for this to be possible? Is it possible to prebuild the routes for deployment?
4 Replies
That notice is just referring to configuring your hosting setup to point to
/
, as client side setups have a single entrypoint. It's not saying that you can only have 1 route, just that /one
and /two
should both fetch the same entrypoint code.Okay i seem to misunderstand this then. Sorry i am relatively new to this and dont really understand. So it will be possible for the users to enter the specific routes? I will deploy with nginx, i will look into how i can redirect to the entrypoint. Thanks
Yeah they'll be able to access all the routes, just configure nginx to priorities fetching stuff directly from the disk, and then if a path doesn't exist return
index.html
Alright, i will try to set this up. Thank you
Yes it works. Thanks!