fix(service): Rallly login fails with invalid origin error#9536
Open
SeriousM wants to merge 1 commit intocoollabsio:nextfrom
Open
fix(service): Rallly login fails with invalid origin error#9536SeriousM wants to merge 1 commit intocoollabsio:nextfrom
SeriousM wants to merge 1 commit intocoollabsio:nextfrom
Conversation
Every registration and login attempt will fail with "invalid origin" error message and the log message "ERROR [Better Auth]: Invalid origin: public-url.com" Setting the BETTER_AUTH_TRUSTED_ORIGINS allows the validation to pass. Using BETTER_AUTH_URL is no option as it's set by NEXT_PUBLIC_BASE_URL which in turn is set to http://localhost:3000 by the build docker image.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Setting the BETTER_AUTH_TRUSTED_ORIGINS allows the validation to pass.
Using BETTER_AUTH_URL is no option as it's set by NEXT_PUBLIC_BASE_URL which in turn is set to http://localhost:3000 by the build docker image.
Issues
Category
Preview
AI Assistance
If AI was used:
Claude code to find the issue, tested by hand.
just to find the bug in the Rallly/Better Auth combination.
Testing
First I encountered the issue, then I tried to find the right env variable which I thought would be "BETTER_AUTH_URL" but that didn't worked out. The next one was "NEXT_PUBLIC_BASE_URL", suggested by other users on the internet having issues with Better Auth - still no luck.
I gave claude my env-setup and the repository and it found that BETTER_AUTH_URL is not the solution because NEXT_PUBLIC_BASE_URL is baked into the image as http://localhost:3000. It also found out that BETTER_AUTH_TRUSTED_ORIGINS will work as it's the dedicated way to tell Better Auth the trusted origins.
Contributor Agreement
Important