I'm currently trying to prerender my routes so that they can be placed on S3 as a static site, without the need to point error pages to index.html
. Even though the app would work, the HTTP response would still be 404.
So I've tried react-snap
to prerender my routes. It works for all routes except those behind authentication. For example, if a user goes to /dashboard
, he will be redirected to /login
. So then react-snap
renders the /login
route for the /dashboard
route.
Is there a better way to be doing this? Thanks in advance.
edit: I'm using react-router for client side routing. The prerendering of pages is just so that S3 does not use the error page for the other routes on initial load.