[PR #4140] [MERGED] demo: fix domain issue on preview env #13462

Closed
opened 2026-04-13 08:57:16 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4140
Author: @himself65
Created: 8/21/2025
Status: Merged
Merged: 8/21/2025
Merged by: @himself65

Base: canaryHead: himself65/2025/08/21/dev


📝 Commits (3)

  • 20bf7cd demo: fix domain issue on preview env
  • 8f436fa fix: cookie domain
  • 69e8d32 Merge branch 'canary' into himself65/2025/08/21/dev

📊 Changes

1 file changed (+21 additions, -1 deletions)

View changed files

📝 demo/nextjs/lib/auth.ts (+21 -1)

📄 Description

Summary by cubic

Fixes domain issues on Vercel previews by setting betterAuth baseURL dynamically. Uses BETTER_AUTH_URL in production, https://${VERCEL_URL} in preview, and leaves it undefined otherwise to prevent invalid redirects.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/4140 **Author:** [@himself65](https://github.com/himself65) **Created:** 8/21/2025 **Status:** ✅ Merged **Merged:** 8/21/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/08/21/dev` --- ### 📝 Commits (3) - [`20bf7cd`](https://github.com/better-auth/better-auth/commit/20bf7cdb65e97ae9c37329440f45da6a4d5b612a) demo: fix domain issue on preview env - [`8f436fa`](https://github.com/better-auth/better-auth/commit/8f436fad56367d19d729954d28be857abdc20e85) fix: cookie domain - [`69e8d32`](https://github.com/better-auth/better-auth/commit/69e8d32861e1ea9dba130de3ddacc88d33ff8cd6) Merge branch 'canary' into himself65/2025/08/21/dev ### 📊 Changes **1 file changed** (+21 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `demo/nextjs/lib/auth.ts` (+21 -1) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Fixes domain issues on Vercel previews by setting betterAuth baseURL dynamically. Uses BETTER_AUTH_URL in production, https://${VERCEL_URL} in preview, and leaves it undefined otherwise to prevent invalid redirects. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 08:57:16 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#13462