diff --git a/shop/lib/utils.ts b/shop/lib/utils.ts index b2566c1..d7d40b4 100644 --- a/shop/lib/utils.ts +++ b/shop/lib/utils.ts @@ -70,11 +70,12 @@ export function resolveSupabaseUrl(url: string | undefined): string | undefined return resolved; } } else { - // Server-Side: Umschreiben auf externe URL oder localhost:8000 + // Server-Side: Umschreiben auf externe URL oder internen Host + const defaultFallback = process.env.IS_DOCKER === 'true' ? 'http://kong:8000' : 'http://localhost:8000'; try { const parsed = new URL(url); if (parsed.hostname === 'supabase-kong' || parsed.hostname === 'kong') { - const ext = extBase || 'http://localhost:8000'; + const ext = extBase || defaultFallback; const extUrl = new URL(ext); parsed.hostname = extUrl.hostname; parsed.port = extUrl.port; @@ -82,7 +83,7 @@ export function resolveSupabaseUrl(url: string | undefined): string | undefined return parsed.toString().replace(/\/$/, ''); } } catch { - const target = extBase || 'http://localhost:8000'; + const target = extBase || defaultFallback; const targetUrl = new URL(target); return url .replace('//supabase-kong:8000', `//${targetUrl.host}`) diff --git a/shop/next.config.ts b/shop/next.config.ts index d00512b..b86b59c 100644 --- a/shop/next.config.ts +++ b/shop/next.config.ts @@ -26,7 +26,7 @@ const nextConfig: NextConfig = { ]; }, async rewrites() { - const supabaseUrl = (process.env.SUPABASE_URL || "http://supabase-kong:8000").replace(/\/$/, ""); + const supabaseUrl = (process.env.SUPABASE_URL || "http://kong:8000").replace(/\/$/, ""); return [ { source: '/auth/v1/:path*',