diff --git a/frontend/next.config.ts b/frontend/next.config.ts index 5b863a3..5e37e82 100755 --- a/frontend/next.config.ts +++ b/frontend/next.config.ts @@ -74,12 +74,14 @@ const nextConfig: NextConfig = { ]; }, - // Ensure we can connect to the backend in Docker + // Proxy API requests to backend + // Use NEXT_PUBLIC_API_BASE_URL for the destination (defaults to localhost for local dev) async rewrites() { + const backendUrl = process.env.NEXT_PUBLIC_API_BASE_URL || 'http://localhost:8000'; return [ { source: '/api/:path*', - destination: 'http://backend:8000/api/:path*', + destination: `${backendUrl}/api/:path*`, }, ]; },