From 9b2737ef774c14ba11df7800dfeba9c0cc7e6516 Mon Sep 17 00:00:00 2001 From: Ryan Malloy Date: Fri, 13 Feb 2026 03:45:23 -0700 Subject: [PATCH] Set PUBLIC_API_URL at build time for production Vite inlines import.meta.env.PUBLIC_* at build time, not runtime. Without this, the frontend falls back to localhost:8099 which doesn't exist from the browser. Empty string means same-origin requests, letting Caddy route /api/* to the backend. --- frontend/Dockerfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index ed39f80..a5cbc29 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -24,6 +24,12 @@ RUN npm ci COPY . . ENV ASTRO_TELEMETRY_DISABLED=1 + +# PUBLIC_API_URL must be set at build time for Vite to inline it. +# Empty string = same-origin (Caddy routes /api/* to backend). +ARG PUBLIC_API_URL="" +ENV PUBLIC_API_URL=${PUBLIC_API_URL} + RUN npm run build