fix(web): use INTERNAL_API_URL for API rewrites proxy

This commit is contained in:
Apple
2025-11-29 17:09:50 -08:00
parent 52520eda93
commit c68b81fad1

View File

@@ -4,19 +4,20 @@ const nextConfig: NextConfig = {
output: 'standalone', output: 'standalone',
async rewrites() { async rewrites() {
// In production, API calls go to same origin // INTERNAL_API_URL is the backend service URL (city-service)
// In dev, proxy to local backend // Used for proxying API requests from the frontend to the backend
const apiBase = process.env.NEXT_PUBLIC_API_BASE_URL || '' const internalApiUrl = process.env.INTERNAL_API_URL || 'http://localhost:7001'
if (apiBase && apiBase !== '') { return [
return [ {
{ source: '/api/v1/:path*',
source: '/api/:path*', destination: `${internalApiUrl}/api/v1/:path*`,
destination: `${apiBase}/api/:path*`, },
}, {
] source: '/api/:path*',
} destination: `${internalApiUrl}/api/:path*`,
return [] },
]
}, },
} }