diff --git a/frontend/next.config.ts b/frontend/next.config.ts index 66e15661..fdbed71b 100644 --- a/frontend/next.config.ts +++ b/frontend/next.config.ts @@ -1,8 +1,20 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { - /* config options here */ + output: 'standalone', reactCompiler: true, + async rewrites() { + // Use BACKEND_URL env var, or fallback to public Railway URL + // In Railway, services cannot use simple hostnames to communicate + const backendUrl = process.env.BACKEND_URL || "https://tradinaagents-backend.up.railway.app"; + + return [ + { + source: "/api/:path*", + destination: `${backendUrl}/api/:path*`, + }, + ]; + }, }; export default nextConfig;