-
-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to override Supabase service URLs in client #443
base: master
Are you sure you want to change the base?
Allow to override Supabase service URLs in client #443
Conversation
Add 4 options to SupabaseClient that allow to set urls for Supabase services: REST, Realtime, Auth, Storage, by option keys restUrl, realtimeUrl, authUrl and storageUrl. The option should contain full url (eg. https://foo.com/auth/v1 for GoTrue hosted at such url.)
I just noticed this is a duplicate of PR supabase/supabase#399 - almost identical but a bit more concise. |
Hey Supabase team! This is a very small change, can you review? |
Hey @marcinkoziej, this change isn't particularly necessary if you intend to just self-host gotrue. Have you tried using the gotrue-js client directly instead? You can directly instantiate the |
I'll close this for inactivity, but for folks bumping into the issue mentioned by OP, my recommendation is to use an API gateway to route the |
@kangmingtay sorry for late reply. We want to use Supabase (so all the services via SupabaseClient) but to host gotrue ourselves (so that we can use custom domain for Google OIDC and our email server). Because of how SupabaseClient is encapsulated using TS OO primitives, it is impossible to override only authUrl. I could change the My point is the style of how SupabaseClient is coded, does not really make its extension possible or even easy. @soedirgo yeah I could proxy all the api calls, but why? This will be less reliable and slower. i'd like only serve Auth api, rest should go straight to my Supabase project. |
This a really simple change, and I don't see the problem with it. |
Add 4 options to SupabaseClient that allow to set urls for Supabase
services: REST, Realtime, Auth, Storage, by option keys restUrl,
realtimeUrl, authUrl and storageUrl. The option should contain full
url (eg. https://foo.com/auth/v1 for GoTrue hosted at such url.)
What kind of change does this PR introduce? What is the current behavior?
Current SupabaseClient behaviour is to accept an url to Supabase instance, and construct sub-service urls by appending paths (
/rest/v1
,/auth/v1
etc).This change allows to override the urls by passing them in options, when for example in self-hosting context such services run under different domains.
Please link any relevant issues here.
This solution helps to mitigate lack of custom domain support in Supabase.
Thanks to generously decoupled architecture, we will be able to just self-host GoTrue under our custom domain, and use SaaS Supabase. For this to work, we need to pass
authUrl
that points to our custom GoTrue instance.What is the new behavior?
The new behaviour is same, unless options are used to override URLs for Supabase sub-services.