OAuth redirect_uri uses wrong domain on multi-domain Vercel setup
Hey! I'm trying to run better-auth on a Vercel deployment with 2 domains pointing to the same instance (dev.example.com and dev.tryexample.com).
When users access dev.example.com and try OAuth login, the redirect_uri gets generated with dev.tryexample.com instead, causing state mismatch errors.
It seems better-auth reads x-forwarded-host which Vercel sets to the "primary" domain. Is there a config option to make better-auth use the actual request Host header instead? Or a way to set baseURL dynamically per-request?
Currently working around it by removing x-forwarded-host in middleware but wondering if there's a better approach.
When users access dev.example.com and try OAuth login, the redirect_uri gets generated with dev.tryexample.com instead, causing state mismatch errors.
It seems better-auth reads x-forwarded-host which Vercel sets to the "primary" domain. Is there a config option to make better-auth use the actual request Host header instead? Or a way to set baseURL dynamically per-request?
Currently working around it by removing x-forwarded-host in middleware but wondering if there's a better approach.