Tanstack Start
Hono:3000) and a separate Hono API (:5000) where Better Auth is mounted.:5000 validates the token, creates a session, sets a session cookie, and redirects (302) the user to localhost:3000/identity-verification./identity-verification route has a beforeLoad guard that calls authClient.getSession() to check if the user is authenticated. This runs during SSR on the TanStack Start server. During SSR, the server makes a fetch to localhost:5000/api/auth/get-session β but without any cookies. So Better Auth returns "no session" β redirects to /login => user is stuck in a loop.beforeLoad runs server-side during SSR, not in the browser. The SSR server doesn't have the user's cookies, so it can't prove the user is authenticated when calling the auth API.createServerFn + getRequestHeaders() from @tanstack/react-start/server that grabs the cookies from the incoming browser request during SSR and forwards them to the Hono API:authClient.getSession():crossSubDomainCookies in the Better Auth config for production (so app.domain.com and api.domain.com share cookies), and fixed trustedOrigins to default to ['http://localhost:3000'] instead of an empty array.getRequestHeaders() in a createServerFn the right/recommended pattern when Better Auth lives on a separate server?