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