[GH-ISSUE #642] Better Auth works on localhost but NOT production server #8353

Closed
opened 2026-04-13 03:25:26 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @trunglehuynh on GitHub (Nov 24, 2024).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/642

Describe the bug
I tested Better-Auth on local dev(http://localhost:3000/), it is working fine but the production version (host in vercel.com) does not work, all GET and POST https://<www.mydomain.com>/api/auth/get-session requests return 404.

To Reproduce
Steps to reproduce the behavior:
Request GET and POST https://<www.mydomain.com>/api/auth/get-session and get return 404

Expected behavior
Those requests should return 200 as localhost:3000

Screenshots
n/a
Desktop (please complete the following information):
Google Chrome

Tried:
-I tested the production database, and It is working fine.
-update provider client_id and client_secret.

Originally created by @trunglehuynh on GitHub (Nov 24, 2024). Original GitHub issue: https://github.com/better-auth/better-auth/issues/642 **Describe the bug** I tested Better-Auth on local dev(http://localhost:3000/), it is working fine but the production version (host in vercel.com) does not work, all GET and POST https://<www.mydomain.com>/api/auth/get-session requests return 404. **To Reproduce** Steps to reproduce the behavior: Request GET and POST https://<www.mydomain.com>/api/auth/get-session and get return 404 **Expected behavior** Those requests should return 200 as localhost:3000 **Screenshots** n/a **Desktop (please complete the following information):** Google Chrome Tried: -I tested the production database, and It is working fine. -update provider client_id and client_secret.
GiteaMirror added the locked label 2026-04-13 03:25:26 -05:00
Author
Owner

@anatoliy-t7 commented on GitHub (Nov 25, 2024):

Did you solve it?

<!-- gh-comment-id:2497950457 --> @anatoliy-t7 commented on GitHub (Nov 25, 2024): Did you solve it?
Author
Owner

@trunglehuynh commented on GitHub (Nov 25, 2024):

yes, it was an env mistake, I set URL=https://<mydomain.com>/ , but it should be URL=https://<mydomain.com> without slash

<!-- gh-comment-id:2498591186 --> @trunglehuynh commented on GitHub (Nov 25, 2024): yes, it was an env mistake, I set **URL=https://<mydomain.com>/** , but it should be **URL=https://<mydomain.com>** without slash
Author
Owner

@anatoliy-t7 commented on GitHub (Nov 26, 2024):

Thank for reply, but it does not work for me :(

<!-- gh-comment-id:2499525659 --> @anatoliy-t7 commented on GitHub (Nov 26, 2024): Thank for reply, but it does not work for me :(
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8353