[GH-ISSUE #838] Invalid currentURL on nextjs coolify deploy #8459

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

Originally created by @nytocode on GitHub (Dec 9, 2024).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/838

Describe the bug
Sign in work correctly locally but when deployed to coolify it gives "Invalid currentURL" error, the currentURL query parameter doesn't seem to be correct

To Reproduce
Steps to reproduce the behavior:

  1. Deploy next app to coolify
  2. Access the app via generated domain
  3. Try to login (or any other api action

Expected behavior
I expect the app to behave as it behave locally

Screenshots
Screenshot 2024-12-09 at 14 08 14

Additional context
The app is deployed with sef hosted coolify

Originally created by @nytocode on GitHub (Dec 9, 2024). Original GitHub issue: https://github.com/better-auth/better-auth/issues/838 **Describe the bug** Sign in work correctly locally but when deployed to coolify it gives "Invalid currentURL" error, the currentURL query parameter doesn't seem to be correct **To Reproduce** Steps to reproduce the behavior: 1. Deploy next app to coolify 2. Access the app via generated domain 3. Try to login (or any other api action **Expected behavior** I expect the app to behave as it behave locally **Screenshots** <img width="828" alt="Screenshot 2024-12-09 at 14 08 14" src="https://github.com/user-attachments/assets/1a14706d-a0bc-49a3-a7a2-ebf9acfac5b1"> **Additional context** The app is deployed with sef hosted coolify
GiteaMirror added the locked label 2026-04-13 03:31:37 -05:00
Author
Owner

@Sama-004 commented on GitHub (Dec 9, 2024):

@nytocode have you changed the BETTER_AUTH_URL in the env

<!-- gh-comment-id:2528069046 --> @Sama-004 commented on GitHub (Dec 9, 2024): @nytocode have you changed the `BETTER_AUTH_URL` in the env
Author
Owner

@nytocode commented on GitHub (Dec 9, 2024):

@Sama-004 Yes I tried changing it and passing it directly in the client but seems not to work

<!-- gh-comment-id:2528081704 --> @nytocode commented on GitHub (Dec 9, 2024): @Sama-004 Yes I tried changing it and passing it directly in the client but seems not to work
Author
Owner

@nytocode commented on GitHub (Dec 9, 2024):

Found the problem. It seems I need to add my deploy url to trusedOrigins in better auth config

<!-- gh-comment-id:2528195005 --> @nytocode commented on GitHub (Dec 9, 2024): Found the problem. It seems I need to add my deploy url to trusedOrigins in better auth config
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8459