Too Many Redirects when change authentication to better-auth

Author: luisalbuquerque00Created Mar 20, 2026Updated Mar 20, 2026
Labelsbug

Describe the bug I switched the authentication method from Clerk to Better-Auth, and whenever I try to access the sign-in/sign-up page, I get the error message "too many redirects."

I believe the problem lies in this section of the code:

typescript
// auth/proxy.ts

if (!sessionCookie) {
  return NextResponse.redirect(new URL("/sign-in", request.url));
}

next-forge version I am using version 5.3.2

To Reproduce Steps to reproduce the behavior:

  1. Change Clerk to Better-Auth
  2. Clear cookies
  3. Go to sign-in page
  4. Error too many redirect trigged
  5. See error

Expected behavior Switching the authentication method should work exactly as it does when using Clerk as the authentication provider.

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser Chrome/Arc