From 01450b5bacf19126e082b01309678e3b654ca0f5 Mon Sep 17 00:00:00 2001 From: "Kenneth C. Arnold" Date: Wed, 5 Aug 2026 09:49:08 -0400 Subject: [PATCH 1/2] Use the origin to get backend, so staging doesn't hit prod backend. --- frontend/src/api/index.ts | 38 ++++++++++++++++++-------------------- frontend/vite.config.ts | 9 +-------- 2 files changed, 19 insertions(+), 28 deletions(-) diff --git a/frontend/src/api/index.ts b/frontend/src/api/index.ts index 89bd40f6..2108bfa4 100644 --- a/frontend/src/api/index.ts +++ b/frontend/src/api/index.ts @@ -1,36 +1,34 @@ /** * Resolves the backend base URL. * - * Everywhere except the Google Docs sidebar a relative `/api` works (Word's dev - * server and the production web host both serve the API under the same origin). + * Whatever origin served this bundle also serves the backend API, so we + * discover it at runtime instead of baking it in at build time — one built + * image is deployed to both staging and production, and a compile-time + * constant would send the staging sidebar to the production backend. * - * The Google Docs sidebar is different: its HTML is served from a Google origin, - * so a relative `/api` would hit Google's domain instead of the backend: + * The Google Docs sidebar is the case that needs the script tag: the page + * itself is on a Google origin, but `sidebar.html` injects our bundle as a + * classic