diff --git a/frontend/next.config.ts b/frontend/next.config.ts index b8918212..af653217 100644 --- a/frontend/next.config.ts +++ b/frontend/next.config.ts @@ -7,8 +7,11 @@ const nextConfig: NextConfig = { // In development: use localhost backend // In production (Railway): use BACKEND_URL env var or fallback to Railway URL const isDev = process.env.NODE_ENV === 'development'; + // Default to http://backend:8000 in production (Docker) if not set const backendUrl = process.env.BACKEND_URL || - (isDev ? "http://localhost:8000" : "https://tradingagents-backend.up.railway.app"); + (isDev ? "http://localhost:8000" : "http://backend:8000"); + + console.log(`[Next.js] Rewriting API requests to: ${backendUrl}`); return [ {