fix: change default internal rewrite and server resolution host to kong
All checks were successful
Staging Build / build (push) Successful in 3m28s

This commit is contained in:
DanielS
2026-07-04 17:19:09 +02:00
parent f82f08ffd0
commit 5bad959b13
2 changed files with 5 additions and 4 deletions

View File

@@ -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}`)

View File

@@ -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*',