fix: Frontend proxy uses pounce-backend in production

- next.config.js now detects NODE_ENV=production
- Uses http://pounce-backend:8000 in Docker instead of localhost
- Logs backend URL during build for debugging
This commit is contained in:
2025-12-20 23:39:43 +01:00
parent c5a9bd83d5
commit 4995101dd1

View File

@ -161,8 +161,12 @@ const nextConfig = {
// Proxy API requests to backend // Proxy API requests to backend
// This ensures /api/v1/* works regardless of how the server is accessed // This ensures /api/v1/* works regardless of how the server is accessed
async rewrites() { async rewrites() {
// Determine backend URL based on environment // In production (Docker), use internal container hostname
const backendUrl = process.env.BACKEND_URL || 'http://127.0.0.1:8000' // In development, use localhost
const isProduction = process.env.NODE_ENV === 'production'
const backendUrl = process.env.BACKEND_URL || (isProduction ? 'http://pounce-backend:8000' : 'http://127.0.0.1:8000')
console.log(`[Next.js Config] Backend URL: ${backendUrl}`)
return [ return [
{ {