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-in is 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 is false, which waits until the person actually signs in.

How to fix it, step by step

  1. 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 /block or starts with /block/, it returns and does not redirect again.
  2. 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_URL and NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URL are the ones Clerk recommends. A force URL overrides redirect_url.
  3. For Astro on Netlify, use production API keys on a production domain, as that guide recommends, instead of development keys on the preview URL.
  4. Leave satelliteAutoSync unset unless you mean for every first visit to bounce to the primary domain.
  5. 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

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.

Request a fix