diff --git a/src/SupabaseClient.ts b/src/SupabaseClient.ts index 5e12c835..79c55ca9 100644 --- a/src/SupabaseClient.ts +++ b/src/SupabaseClient.ts @@ -74,10 +74,10 @@ export default class SupabaseClient { const _supabaseUrl = stripTrailingSlash(supabaseUrl) const settings = { ...DEFAULT_OPTIONS, ...options } - this.restUrl = `${_supabaseUrl}/rest/v1` - this.realtimeUrl = `${_supabaseUrl}/realtime/v1`.replace('http', 'ws') - this.authUrl = `${_supabaseUrl}/auth/v1` - this.storageUrl = `${_supabaseUrl}/storage/v1` + this.restUrl = options?.restUrl || `${_supabaseUrl}/rest/v1` + this.realtimeUrl = options?.realtimeUrl || `${_supabaseUrl}/realtime/v1`.replace('http', 'ws') + this.authUrl = options?.authUrl || `${_supabaseUrl}/auth/v1` + this.storageUrl = options?.storageUrl || `${_supabaseUrl}/storage/v1` const isPlatform = _supabaseUrl.match(/(supabase\.co)|(supabase\.in)/) if (isPlatform) { diff --git a/src/lib/types.ts b/src/lib/types.ts index 5872cb41..dab267a8 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -58,6 +58,26 @@ export type SupabaseClientOptions = { * Options passed to the gotrue-js instance */ cookieOptions?: SupabaseAuthClientOptions['cookieOptions'] + + /** + * Override the restUrl + */ + restUrl?: string + + /** + * Override the realtimeUrl (must be ws:// scheme) + */ + realtimeUrl?: string + + /** + * Override the authUrl + */ + authUrl?: string + + /** + * Override the storageUrl + */ + storageUrl?: string } export type SupabaseRealtimePayload = {