From dd3624018ac417f728650b5fe5615d27ef2a6bd3 Mon Sep 17 00:00:00 2001 From: Apple Date: Sun, 30 Nov 2025 06:17:25 -0800 Subject: [PATCH] fix: Add proper Next.js rewrites for agent/microdao API - /api/agents/:agentId/dashboard -> /city/agents/:agentId/dashboard - /api/microdao/* -> /city/microdao/* - /api/public/* -> /public/* - /api/city/* -> /city/* Fixes 404 errors on agent/microdao cabinet pages --- apps/web/next.config.ts | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/apps/web/next.config.ts b/apps/web/next.config.ts index 59739b55..a4bdecb8 100644 --- a/apps/web/next.config.ts +++ b/apps/web/next.config.ts @@ -12,13 +12,35 @@ const nextConfig: NextConfig = { console.log('[next.config] INTERNAL_API_URL:', internalApiUrl) return [ + // Agent dashboard API -> /city/agents + { + source: '/api/agents/:agentId/dashboard', + destination: `${internalApiUrl}/city/agents/:agentId/dashboard`, + }, + // Microdao API -> /city/microdao + { + source: '/api/microdao/:path*', + destination: `${internalApiUrl}/city/microdao/:path*`, + }, + // Public API -> /public + { + source: '/api/public/:path*', + destination: `${internalApiUrl}/public/:path*`, + }, + // City API -> /city + { + source: '/api/city/:path*', + destination: `${internalApiUrl}/city/:path*`, + }, + // Governance/Audit/Incidents -> /api/v1 { source: '/api/v1/:path*', destination: `${internalApiUrl}/api/v1/:path*`, }, + // Fallback for other /api routes { source: '/api/:path*', - destination: `${internalApiUrl}/api/:path*`, + destination: `${internalApiUrl}/:path*`, }, ] },