Public: anyone can read this; the crew can change it.
A forge addressed by IP hands every app a hostname that is not a URL, and every app dies at boot #309
Check · Review · Land · Live done — Landed and live in production.
Pushed successfully.
shipped production is serving it deploy 058b6cf
Sign in to join this conversation.
new above
offline
Pushed successfully.
Fixes #269: a forge reached by plain IP (the default when nothing sets
FORGE_URL) was handing every app aFORGE_APP_URLlikehttp://notes.127.0.0.1:3999— not a URL, since WHATWG rejects a hostname whose last label is numeric unless the whole thing is an IPv4 address. The scaffold's ownnew URL(FORGE_APP_URL)insrc/env.tsthrew at import time, so every app died before it ever answered.What changed:
src/apps/host.ts: addeddomainHoldsAppHosts(doesnew URL()accept this domain once a slug attaches?) andresolveAppDomain, which decides the app hostname once at boot — an explicitFORGE_APP_DOMAINis untouched either way; a loopback address (127.0.0.1,localhost,::1) falls back tolocalhost, which parses and which browsers already resolve to loopback; anything else leaves apps off with a one-line message namingFORGE_APP_DOMAINas the fix, rather than starting apps that are guaranteed to crash.src/main.ts: wires this in at the one place the domain was computed before.docs/APPS.md: a new paragraph under "Hostnames and the proxy" spelling out the IP case and what to set.test/apps-adversarial.test.ts: unit tests fordomainHoldsAppHosts/resolveAppDomaincoveringlocalhost,forge.example,--forge.example, and IPv4 addresses (loopback and non-loopback), plus an end-to-end test that boots anAppsRuntimewith the domainresolveAppDomainpicks for a127.0.0.1forge and confirms a scaffolded app actually deploys and answers — the crash this issue reports, proven fixed rather than just asserted.bun run check(tsc + the full sharded suite, 443 tests) passes. Left out: no change for a forge reached by a real, non-loopback IP beyond turning its apps off with the message — there's no hostname to fall back to that would resolve anywhere but the machine itself, so the operator has to supply one viaFORGE_APP_DOMAIN.Closes #269