From 9e68bdd1fa0734770f01b5489fb5c073a75f6888 Mon Sep 17 00:00:00 2001 From: bchanot Date: Wed, 4 Nov 2026 23:51:55 +0100 Subject: [PATCH] docs(supabase): trial comments and guide state the refusals exactly --- apps/app/vite/trial.config.ts | 11 ++++++----- docs/development/V1-2-6_OWNER_TRIAL.md | 6 +++--- scripts/db-sandbox.sh | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/apps/app/vite/trial.config.ts b/apps/app/vite/trial.config.ts index 2919f032..ed977244 100644 --- a/apps/app/vite/trial.config.ts +++ b/apps/app/vite/trial.config.ts @@ -5,7 +5,8 @@ import base from '../vite.config' /** * Dev server of `pnpm db:sandbox trial` (docs/development/V1-2-6_OWNER_TRIAL.md). * The browser talks to this origin only: the three Supabase routes are - * forwarded to the trial gateway on loopback, so no CORS rule is involved. + * forwarded to the trial gateway on loopback, so the app itself needs no CORS (the proxied + * routes keep the stack's own CORS headers). * The server binds the one host that scripts/db-sandbox.sh validated (loopback or a private * address of this machine) and refuses any other Host header. */ @@ -28,8 +29,8 @@ const SUPABASE_ROUTES = ['/auth/v1', '/rest/v1', '/storage/v1'] const REPO = fileURLToPath(new URL('../../../', import.meta.url)) /** - * `allowedHosts` still lets every IP literal and localhost through (Vite 7): any HTTP request - * whose Host is not the trial host gets a 403, and the editor-launch route is closed to the LAN. + * `allowedHosts` still lets every IP literal and localhost through (Vite 7): any HTTP request whose + * Host is not the trial host is refused (403; the editor-launch route answers 404 to every Host). * The trial serves no WebSocket: the proxy's upgrade listener would hold such a socket open, so * every upgrade is closed at once. */ @@ -59,8 +60,8 @@ export default defineConfig((env) => host, strictPort: true, allowedHosts: [host], - // Same origin through the proxy: no CORS answer, and no hot-reload socket (its upgrade - // skips the middlewares above) on a manual trial. + // Same origin through the proxy: Vite adds no CORS header, and no hot-reload socket + // (its upgrade skips the middlewares above) on a manual trial. cors: false, ws: false, // The LAN sees the app's own sources only: never the repository's notes, seed or builds. diff --git a/docs/development/V1-2-6_OWNER_TRIAL.md b/docs/development/V1-2-6_OWNER_TRIAL.md index 0db904bb..988e6acd 100644 --- a/docs/development/V1-2-6_OWNER_TRIAL.md +++ b/docs/development/V1-2-6_OWNER_TRIAL.md @@ -64,9 +64,9 @@ une interface de cette machine ; `0.0.0.0`, un nom et une adresse publique sont Un seul port est ouvert au réseau local : **5193**, sur cette adresse uniquement (pas sur `0.0.0.0`). Vite relaie `/auth/v1`, `/rest/v1` et `/storage/v1` vers une passerelle de l'essai publiée sur `127.0.0.1:57801` ; tous les -services de la pile jetable restent sur `127.0.0.1`. Le serveur d'essai refuse (403) toute requête HTTP dont -l'en-tête `Host` n'est pas l'adresse d'essai, y compris une autre adresse IP ou `localhost`. Il ferme toute -connexion websocket (pas de rechargement automatique : après une modification du code, rechargez la page à la +services de la pile jetable restent sur `127.0.0.1`. Le serveur d'essai refuse toute requête HTTP dont l'en-tête +`Host` n'est pas l'adresse d'essai, y compris une autre adresse IP ou `localhost` (réponse 403 ; la route +`/__open-in-editor` de Vite répond 404 à tous). Il ferme toute connexion websocket (pas de rechargement automatique : après une modification du code, rechargez la page à la main). Vite n'ajoute aucun en-tête CORS ; les routes Supabase relayées gardent ceux de la pile jetable, sans effet sur la session, qui reste dans le navigateur de l'essai et n'est jamais un cookie. La commande refuse de démarrer si la passerelle de l'essai existe déjà ou si l'un des ports est pris. diff --git a/scripts/db-sandbox.sh b/scripts/db-sandbox.sh index f6e7ed3e..93dd7304 100755 --- a/scripts/db-sandbox.sh +++ b/scripts/db-sandbox.sh @@ -429,7 +429,7 @@ trial_stop() { } # The app origin is the Vite server itself (/auth/v1, /rest/v1, /storage/v1 are proxied to the -# trial gateway, apps/app/vite/trial.config.ts): same origin, no CORS. The anon key reaches Vite +# trial gateway, apps/app/vite/trial.config.ts): same origin, the app needs no CORS. The anon key reaches Vite # through its environment, never argv. cmd_trial() { load_secrets