[GH-ISSUE #2720] Allow to specify wildcard domains for trusted origins #9319

Closed
opened 2026-04-13 04:45:12 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @BjoernRave on GitHub (May 19, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/2720

Is this suited for github?

  • Yes, this is suited for github

I have a wildcard url, where I want to accept requests from, so currently I can only do: trustedOrigins: ["*"].

Describe the solution you'd like

trustedOrigins: ["example.com", "*.foo.com"]

Describe alternatives you've considered

trustedOrigins: ["*"]

Additional context

No response

Originally created by @BjoernRave on GitHub (May 19, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/2720 ### Is this suited for github? - [ ] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. I have a wildcard url, where I want to accept requests from, so currently I can only do: `trustedOrigins: ["*"]`. ### Describe the solution you'd like `trustedOrigins: ["example.com", "*.foo.com"]` ### Describe alternatives you've considered `trustedOrigins: ["*"]` ### Additional context _No response_
GiteaMirror added the locked label 2026-04-13 04:45:12 -05:00
Author
Owner

@Kalyankr commented on GitHub (May 20, 2025):

I do have the issue, I have dynamic subdomains and cannot list all in the trustOrigins, not sure how to handle those.
example
trustedOrigins: [ "http://portal.localhost:3000", "http://oakwood.localhost:3000", ],

TrustOrgins can grow, so having then in list is not possible, do we need to get them from db and pass it as array or any wildcard url can be used.

<!-- gh-comment-id:2895902088 --> @Kalyankr commented on GitHub (May 20, 2025): I do have the issue, I have dynamic subdomains and cannot list all in the trustOrigins, not sure how to handle those. example ` trustedOrigins: [ "http://portal.localhost:3000", "http://oakwood.localhost:3000", ],` TrustOrgins can grow, so having then in list is not possible, do we need to get them from db and pass it as array or any wildcard url can be used.
Author
Owner

@dosubot[bot] commented on GitHub (Aug 19, 2025):

Hi, @BjoernRave. I'm Dosu, and I'm helping the better-auth team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You requested support for wildcard domains like "*.foo.com" in the trustedOrigins configuration for more granular control.
  • Another user mentioned difficulties with dynamic subdomains and the impracticality of listing all trusted origins.
  • The core need is for more flexible origin matching to efficiently handle dynamic or numerous subdomains.
  • No resolution or official support for wildcard or database-driven origin lists has been implemented yet.

Next Steps:

  • Please let me know if this issue is still relevant with the latest version of better-auth by commenting below.
  • If I don’t hear back within 7 days, I will automatically close this issue to keep the backlog manageable.

Thanks for your understanding and contribution!

<!-- gh-comment-id:3201345166 --> @dosubot[bot] commented on GitHub (Aug 19, 2025): Hi, @BjoernRave. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog and am marking this issue as stale. **Issue Summary:** - You requested support for wildcard domains like "*.foo.com" in the trustedOrigins configuration for more granular control. - Another user mentioned difficulties with dynamic subdomains and the impracticality of listing all trusted origins. - The core need is for more flexible origin matching to efficiently handle dynamic or numerous subdomains. - No resolution or official support for wildcard or database-driven origin lists has been implemented yet. **Next Steps:** - Please let me know if this issue is still relevant with the latest version of better-auth by commenting below. - If I don’t hear back within 7 days, I will automatically close this issue to keep the backlog manageable. Thanks for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#9319