Clerk sign-in keeps redirecting in a loop
The app bounces between the page and Clerk sign-in forever? The redirect target is protected too, or the force-redirect URL points back at the gate.
Reviewed October 14, 2026
What it means in plain English
Sign-in never finishes. The browser jumps between your page and Clerk, over and over. Clerk's own docs show this when middleware redirects a visitor to a URL that the same middleware redirects again, and when an Astro app on Netlify caches a redirect.
Likely causes
- Middleware sends signed-out people to
/sign-in, and/sign-inis also covered by that redirect. - A force redirect URL always wins. If it points at a page that immediately sends the user back to sign-in, the two redirects chase each other. Clerk says to set both the sign-in and sign-up URLs, because people switch between those screens.
- An Astro app on Netlify. Clerk's Astro deploy guide says Netlify's caching breaks one of Clerk's redirect steps and causes infinite redirects, including on preview deploys that use development API keys.
- A satellite app with
satelliteAutoSync: true. Clerk says that redirects to the primary domain on every first visit. The default isfalse, which waits until the person actually signs in.
How to fix it, step by step
- In middleware, return before you redirect when the path is already the destination. Clerk's geo-blocking sample does this for
/block: if the path is/blockor starts with/block/, it returns and does not redirect again. - Set the sign-in and sign-up fallback (or force) URLs to a page that does not itself redirect to sign-in. Environment variables such as
NEXT_PUBLIC_CLERK_SIGN_IN_FALLBACK_REDIRECT_URLandNEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URLare the ones Clerk recommends. A force URL overridesredirect_url. - For Astro on Netlify, use production API keys on a production domain, as that guide recommends, instead of development keys on the preview URL.
- Leave
satelliteAutoSyncunset unless you mean for every first visit to bounce to the primary domain. - Redeploy after env changes. The live site is still running the old middleware until you do.
How to check it worked
- Open a signed-out window, go to a protected page, sign in once, and land on the page you set. The address bar should stop changing.
- The sign-in URL itself should render Clerk's form, not another redirect.
Sources
- https://clerk.com/docs/guides/development/customize-redirect-urls (opens in a new tab)
- https://clerk.com/docs/guides/development/geo-blocking (opens in a new tab)
- https://clerk.com/docs/guides/development/deployment/astro (opens in a new tab)
- https://clerk.com/docs/reference/nextjs/clerk-middleware (opens in a new tab)
Related fixes
Can't fix it? Get help.
If the steps didn't clear the error, send what the screen says. A person can take a look. This is a request for a paid fix, not an instant chat.