This commit is contained in:
MarkLo 2025-11-21 23:19:42 +08:00
parent 987e757d8c
commit 29e53034bb
1 changed files with 4 additions and 1 deletions

View File

@ -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 [
{