From de6b655911793305da62273154072ab8c0876ceb Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 18:29:15 +0000 Subject: [PATCH] Fix proxy default: use cvfs-backend:8080 instead of localhost:9812 API_BASE_URL env var isn't reaching Next.js in Dokploy, so the fallback was localhost:9812. Default to the correct container hostname so it works without any env var configuration. Local dev still overrides via API_BASE_URL. https://claude.ai/code/session_01Xmxm2QLgFBgRJyYD6VukR6 --- .env.example | 3 ++- apps/webapp/next.config.ts | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index a0e8521..0675da0 100644 --- a/.env.example +++ b/.env.example @@ -38,7 +38,8 @@ LOGDIR="/tmp/logs-$NAME/" NEXT_PUBLIC_REQUIRE_AUTH=false NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=your_supabase_anon_key_here -NEXT_PUBLIC_API_BASE_URL=http://localhost:9812 +# Server-side proxy target (read by next.config.ts at runtime, not baked into the bundle) +API_BASE_URL=http://localhost:9812 # MinIO Object Storage (used instead of S3) MINIO_ROOT_USER=minioadmin diff --git a/apps/webapp/next.config.ts b/apps/webapp/next.config.ts index 740aeb0..e86565c 100644 --- a/apps/webapp/next.config.ts +++ b/apps/webapp/next.config.ts @@ -4,7 +4,9 @@ import path from "node:path"; const nextConfig: NextConfig = { outputFileTracingRoot: path.join(process.cwd(), "../.."), async rewrites() { - const backend = process.env.API_BASE_URL ?? "http://localhost:9812"; + // In Docker (Dokploy/compose) the backend container is always reachable at cvfs-backend:8080. + // Override with API_BASE_URL for local dev (e.g. http://localhost:9812). + const backend = process.env.API_BASE_URL ?? "http://cvfs-backend:8080"; return [{ source: "/api/:path*", destination: `${backend}/api/:path*` }]; }, };