From 2f18d3f215e0be2139d91b720ce200c9c1d69a83 Mon Sep 17 00:00:00 2001 From: Kai Chappell Date: Thu, 31 Jul 2025 14:52:27 +0100 Subject: [PATCH] fix(backend): CORS and API URL fixes --- frontend/src/lib/api.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts index bd58112..a1497e7 100644 --- a/frontend/src/lib/api.ts +++ b/frontend/src/lib/api.ts @@ -9,7 +9,11 @@ import type { SubmissionResponse, } from "@/types"; -const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || "http://localhost:8000"; +// Server-side uses internal Docker network, client-side uses public URL +const API_BASE_URL = + typeof window === "undefined" + ? process.env.API_URL || "http://localhost:8000" + : process.env.NEXT_PUBLIC_API_URL || "http://localhost:8000"; export class ApiError extends Error { constructor(