From 96fd97efa9e7c902519704a4ae01248a1c16e75e Mon Sep 17 00:00:00 2001 From: Julian Cuni Date: Sat, 27 Jun 2026 23:16:19 +0200 Subject: [PATCH] fix(web): VITE_API_BASE relative (empty) for the booth's same-origin SPA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit apps/web/.env.production hardcoded VITE_API_BASE=http://127.0.0.1:3000 — a desktop-only value that's WRONG for the booth, which serves the SPA same-origin (Fastify dist/ via Caddy :80) and needs a RELATIVE /api base. An absolute origin baked at build would point the browser at localhost. origin.ts treats empty as relative (API_BASE=""), matching the deploy (the 77b2acb fix / container-deployment "Web access"). The desktop (Tauri) build DOES need an absolute origin, but that app is a deferred separate task (currently hardcoded localhost); it must set VITE_API_BASE for its own build when resumed, not here. Comment updated to say so. --- apps/web/.env.production | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/apps/web/.env.production b/apps/web/.env.production index 8982be7..be488b8 100644 --- a/apps/web/.env.production +++ b/apps/web/.env.production @@ -1,11 +1,14 @@ -# Production build env for the SPA (auto-loaded by `vite build`, which the Tauri -# desktop bundle runs via beforeBuildCommand). NOT loaded by `vite` dev. +# Production build env for the SPA (auto-loaded by `vite build`). NOT loaded by `vite` dev. # -# The desktop shell serves the bundled SPA from tauri://localhost (no proxy, not -# same-origin), so the SPA must reach Fastify by absolute origin. This is the -# appliance's local Fastify address. Not a secret — committed for reproducible -# desktop builds. Override per-deployment if Fastify binds elsewhere. +# RELATIVE /api base (empty value). The booth serves the SPA same-origin (Fastify serves +# dist/, reached via Caddy on :80), so requests must stay relative — baking an absolute +# origin here would point the browser at the wrong host. This matches the deploy +# (wiki/decisions/container-deployment.md "Web access"; the 77b2acb fix). # -# NOTE: a plain browser prod build (Fastify serving dist/ same-origin) does NOT -# want this set. If you build the SPA for that, override VITE_API_BASE="" . -VITE_API_BASE=http://127.0.0.1:3000 +# DESKTOP (Tauri) NOTE: the desktop shell serves the SPA from tauri://localhost (no proxy, +# not same-origin) and DOES need an absolute Fastify origin — but the desktop app is a +# DEFERRED, separate task (it's currently hardcoded to localhost:3000; see apps/desktop + +# the desktop-app-hardcoded-localhost note). When that work resumes, set VITE_API_BASE to +# the appliance's Fastify origin for the desktop build only (e.g. via apps/desktop or an +# exported override), NOT here. +VITE_API_BASE=