fix: change default internal rewrite and server resolution host to kong
All checks were successful
Staging Build / build (push) Successful in 3m28s
All checks were successful
Staging Build / build (push) Successful in 3m28s
This commit is contained in:
@@ -70,11 +70,12 @@ export function resolveSupabaseUrl(url: string | undefined): string | undefined
|
|||||||
return resolved;
|
return resolved;
|
||||||
}
|
}
|
||||||
} else {
|
} 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 {
|
try {
|
||||||
const parsed = new URL(url);
|
const parsed = new URL(url);
|
||||||
if (parsed.hostname === 'supabase-kong' || parsed.hostname === 'kong') {
|
if (parsed.hostname === 'supabase-kong' || parsed.hostname === 'kong') {
|
||||||
const ext = extBase || 'http://localhost:8000';
|
const ext = extBase || defaultFallback;
|
||||||
const extUrl = new URL(ext);
|
const extUrl = new URL(ext);
|
||||||
parsed.hostname = extUrl.hostname;
|
parsed.hostname = extUrl.hostname;
|
||||||
parsed.port = extUrl.port;
|
parsed.port = extUrl.port;
|
||||||
@@ -82,7 +83,7 @@ export function resolveSupabaseUrl(url: string | undefined): string | undefined
|
|||||||
return parsed.toString().replace(/\/$/, '');
|
return parsed.toString().replace(/\/$/, '');
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
const target = extBase || 'http://localhost:8000';
|
const target = extBase || defaultFallback;
|
||||||
const targetUrl = new URL(target);
|
const targetUrl = new URL(target);
|
||||||
return url
|
return url
|
||||||
.replace('//supabase-kong:8000', `//${targetUrl.host}`)
|
.replace('//supabase-kong:8000', `//${targetUrl.host}`)
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ const nextConfig: NextConfig = {
|
|||||||
];
|
];
|
||||||
},
|
},
|
||||||
async rewrites() {
|
async rewrites() {
|
||||||
const supabaseUrl = (process.env.SUPABASE_URL || "http://supabase-kong:8000").replace(/\/$/, "");
|
const supabaseUrl = (process.env.SUPABASE_URL || "http://kong:8000").replace(/\/$/, "");
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
source: '/auth/v1/:path*',
|
source: '/auth/v1/:path*',
|
||||||
|
|||||||
Reference in New Issue
Block a user