From 6e95080de33c02401652ebee85fa9a8bf865020d Mon Sep 17 00:00:00 2001 From: jester Date: Sun, 22 Mar 2026 15:16:32 +0000 Subject: [PATCH] =?UTF-8?q?Update=20open=20threads=20=E2=80=94=20host-base?= =?UTF-8?q?d=20IDE=20deferred,=20Caddy=20root=20cause=20documented?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OPEN_THREADS.md | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/OPEN_THREADS.md b/OPEN_THREADS.md index 8fdda3f..f4f75a1 100644 --- a/OPEN_THREADS.md +++ b/OPEN_THREADS.md @@ -95,32 +95,37 @@ Working flow: 5. all live code-server HTTP + WS traffic proxied through `/__ide/:id/*` 6. API proxies to `http://:8080` -### Host-based IDE URL — Caddy edge (BLOCKED) +### Host-based IDE URL — deferred Goal: open IDE on `dev-.zerolaghub.dev` instead of raw API IP. +State: reverted — Caddy removed, back to working path-based flow. + +Root cause understood: Express resolves relative redirects using the `Host` +header. Without `header_up Host {host}` in Caddy, the bootstrap redirect fires +as `http://10.60.0.245:4000/__ide/6070/` instead of staying on the clean hostname. + +When revisiting, the full Caddyfile block needed is: + ``` -Browser → dev-6070.zerolaghub.dev → Caddy → 127.0.0.1:4000 → API +{ + auto_https off +} + +http://dev-*.zerolaghub.dev { + @dev host dev-*.zerolaghub.dev + reverse_proxy @dev 127.0.0.1:4000 { + header_up Host {host} + } +} ``` -State: -- API env vars set: `DEV_IDE_HOST_SUFFIX=zerolaghub.dev`, `DEV_IDE_RETURN_HOSTED_URL=true` -- API generating correct absolute URL: `http://dev-6070.zerolaghub.dev/?token=...` -- Caddyfile block correct: - ``` - http://dev-*.zerolaghub.dev { - @dev host dev-*.zerolaghub.dev - reverse_proxy @dev 127.0.0.1:4000 - } - ``` -- `auto_https off` global option added +`header_up Host {host}` is the critical line — without it Express loses the +hostname on every redirect. -Blocking issue: browser HSTS cache forces `zerolaghub.dev` subdomains to HTTPS -regardless of Caddy config. Need to clear Chrome HSTS cache: -- `chrome://net-internals/#hsts` -- Delete `zerolaghub.dev` and `dev-6070.zerolaghub.dev` - -Resume here next session. +API env vars already set and working: +- `DEV_IDE_HOST_SUFFIX=zerolaghub.dev` +- `DEV_IDE_RETURN_HOSTED_URL=true` ### Local Dev Access (Headscale/Tailscale — Future) @@ -148,6 +153,7 @@ Completed: - `/__ide/:id/*` — live tunnel proxy (HTTP + WS, target-bound) - dev routing experiment removed (`devRouting.js`, `devDePublisher.js` deleted) - host-based URL generation (`DEV_IDE_HOST_SUFFIX`, `DEV_IDE_RETURN_HOSTED_URL`) +- `handleHostedProxy` — host-based routing via `Host` header vmid extraction Outstanding: