Unclear Astro.redirect
behavior in SSR
#6644
Labels
- P3: minor bug
An edge case that only affects very specific usage (priority)
Astro.redirect
behavior in SSR
#6644
What version of
astro
are you using?latest
Are you using an SSR adapter? If so, which one?
vercel@latest
What package manager are you using?
yarn
What operating system are you using?
doesn't matter
What browser are you using?
chromium
Describe the Bug
Usecase
I'm trying to create a "Protected Route" pattern where a page would be wrapped in a
<ProtectedRoute>
component which would redirect to/login
if a user is not logged in.Problem
Question
Since we must
return Astro.redirect()
, it seems we can't wrap things up a level upper. How to proceed then?Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-fnw2f4?file=src/pages/from-page.astro,src/pages/index.astro,src/pages/redirected.astro,src/pages/from-layout.astro,src/pages/from-component.astro,src/pages/from-other-page.astro&on=stackblitz
Participation
The text was updated successfully, but these errors were encountered: