Hello! This is a publicly accessible home page.
It can be accessed by both the
/home paths. By simply
setting a cookie, Vercel can take logged-in users to
/dashboard using a redirect
or a rewrite.
How does this demo work?
my-router-cookie cookie in the navbar and navigate
When set to:
- the URLs will behave conventionally. Visiting
/will show this Home page, and visiting
/dashboardwill show the Dashboard page.
No bueno. This is default behavior but it's not a good user experience because users will have to click a link to navigate to their dashboard every time they visit your website.
Better. This may cause a slight delay while the redirect occurs, but Vercel does it server-side and it's still really fast.
/shows the contents of
/dashboardwithout changing the URL
Best. This creates a seamless experience where visiting acme.com shows the website for public users and the dashboard for logged-in users.
How do logged-in users see the home page?
Good question. It would suck to force your users to log out before they
can see your website. That's why companies reserve
/home as a
route for logged-in users. Here are some examples:
This demo has gone ahead and done that, so try clicking
rewrite cookie set.