feat: same-origin auth via reverse proxy and secure cookies
Route /api/auth through the same origin in both dev and prod so cookies stay first-party and the browser and React Router SSR share one auth surface. - Vite dev server proxies /api/auth to the Convex HTTP site. - Better Auth uses secure cookies when the site URL is https. - Add docs/auth-proxy.md documenting the required production ingress (Caddy/Traefik) and Convex SITE_URL / CONVEX_SITE_URL setup.
This commit is contained in:
@@ -17,6 +17,7 @@ export const authComponent = createClient<DataModel>(components.betterAuth);
|
||||
|
||||
const createAuth = (ctx: GenericCtx<DataModel>) =>
|
||||
betterAuth({
|
||||
advanced: { useSecureCookies: siteUrl.startsWith("https://") },
|
||||
baseURL: env.CONVEX_SITE_URL,
|
||||
database: authComponent.adapter(ctx),
|
||||
emailAndPassword: {
|
||||
|
||||
Reference in New Issue
Block a user