Status: Accepted (2026-11-29). Extends 0903. Touches 0302 (cookies, Origin/Host) and 0604 (token url).
The user wants to open the local prod-like stack (docker-compose.prod.yml) from another laptop on the same Wi-Fi. Several things stood in the way:
127.0.0.1:8080 only.POST /v1/realtime/token returned one fixed LINORA_REALTIME_URL (ws://127.0.0.1:8080). On the other laptop, 127.0.0.1 is that laptop, so the canvas could never go live.LINORA_ALLOWED_ORIGINS and the web CSP connect-src named only 127.0.0.1 and localhost.NODE_ENV=production, the API sets __Host-linora_session and __Host-linora_csrf with Secure. http://127.0.0.1 and http://localhost are secure contexts, so browsers keep those cookies there. http://192.168.x.x and http://<name>.local are not secure contexts, so browsers drop every Secure cookie, and __Host- requires Secure. Sign-in would answer 200 and the next request 401.proxy_set_header into a location only when the location sets none. Every proxied location in deploy/nginx/edge.conf sets Connection, so the server-level Host, X-Forwarded-For and X-Forwarded-Proto were never sent.
Host: api. Its same-origin fallback (Origin equal to Host, ADR 0302) never matched; only the allow-list worked.X-Forwarded-For reached the API and realtime unchanged. The edge is a trusted proxy, so the API took the client-written address for per-IP limits (auth burst, login lockout per address, realtime connection cap). Anyone who could reach the port could choose their address. On 127.0.0.1 that was only local software; in LAN mode it would be anyone on the Wi-Fi.crypto.subtle, crypto.randomUUID, SharedArrayBuffer/cross-origin isolation, navigator.clipboard, service workers or WebGPU;/assets;Cross-Origin-Opener-Policy is ignored on a non-secure origin (a console note only);LINORA_PROD_LAN_HOSTS (in .env.prod, or the shell). It is a comma list of the IPv4 addresses and host names that other devices use, e.g. 192.0.2.10,my-mac.local.
deploy/prod-up.mjs validates it with deploy/lan.mjs: IPv4 or DNS name only, lower-cased, no loopback.LINORA_PROD_BIND, LINORA_PROD_LAN_ORIGINS, LINORA_PROD_LAN_COOKIE_ORIGINS and LINORA_PROD_LAN_CONNECT_SRC. Unset, they keep the 127.0.0.1-only defaults; a bare docker compose up therefore also falls back to 127.0.0.1 only.npm run prod:env writes an empty LINORA_PROD_LAN_HOSTS= with the warning text..local name cannot be bound. The cost is that the port is open on every network the machine joins while LAN mode is on (see Consequences).LINORA_REALTIME_SAME_ORIGIN=1).
LINORA_ALLOWED_ORIGINS entry is mapped to its socket origin (http to ws, https to wss).Origin is in that map gets that URL. Any other caller gets LINORA_REALTIME_URL: no Origin (PAT scripts, the MCP, which rewrites it per ADR 0604), or an unlisted Origin that passed the same-origin check./v1/realtime on every origin, so http://localhost:8080 now gets ws://localhost:8080 instead of ws://127.0.0.1:8080..local name with capitals (scutil prints the name as it was configured, e.g. My-Mac) therefore still matches.LINORA_COOKIE_INSECURE_ORIGINS).
http://, not loopback, and also in LINORA_ALLOWED_ORIGINS; anything else is a start-up error.cookieSecure on, a request whose Host is one of these gets the unprefixed linora_session/linora_csrf without Secure. Their other attributes stay the same: HttpOnly session, SameSite=Lax, Path=/.__Host- + Secure, and reads only that name. The default 127.0.0.1/localhost setup is unchanged: it never accepts the unprefixed cookie in production, even with LAN mode on.Host $http_host, X-Forwarded-For $remote_addr and X-Forwarded-Proto.
deploy/smoke.mjs <base> works for any origin, including a LAN host.
--any-realtime-origin allows a deliberately separate realtime origin..local name, so it needs re-issuing when the IP changes, and it adds a TLS listener and certificate files to the edge. Clicking through a self-signed warning is not a substitute: remembered exceptions differ per browser, and the API’s production HSTS header would then pin the host and make the warning impossible to bypass. Nothing in the app needs a secure context, so plain HTTP is the simplest thing that works. This remains the follow-up if the user wants the LAN hop encrypted.LINORA_COOKIE_SECURE for the whole stack in LAN mode. Simpler, but it also downgrades 127.0.0.1/localhost to unprefixed cookies, which can then be shadowed. It was rejected because the default setup must not weaken.__Host- one on the default hosts. Selecting by Host avoids that./v1 contract for every consumer: the MCP’s withRealtimeOrigin and scripts would need a base, and the OpenAPI text says “wss URL”. The origin map keeps absolute URLs..local.LINORA_PROD_LAN_HOSTS, then npm run prod:up) on networks you don’t trust. Signup is open on this stack, so anyone who can reach the port can create an account; they see only their own projects.X-Forwarded-For: 6.6.6.6 that the API ignored), so this machine and the LAN laptop share one per-IP bucket (auth burst 10, then 1 per 6 s). That is fine for a few people. Real addresses need host networking or an L4 proxy with PROXY protocol, as in production..local name survives DHCP changes, but only while the Mac advertises it over Bonjour. The managed Mac this was built on does not: its own name gets no mDNS answer even locally, while other Macs on the same Wi-Fi resolve. A DHCP reservation in the router keeps the IP stable instead. For a new IP, edit LINORA_PROD_LAN_HOSTS and run npm run prod:up. Only api, web and edge are recreated, and prod-up warns about a stale IP or a name that does not resolve.http://localhost:8080 now gets a ws://localhost:8080 socket, and the edge now forwards Host and its own X-Forwarded-For.LINORA_REALTIME_SAME_ORIGIN and LINORA_COOKIE_INSECURE_ORIGINS are off by default. A production edge must also replace or sanitise X-Forwarded-For at its outermost hop (deploy.md).deploy/lan.test.mjs: host parsing, derived variables, stale IPs;apps/api/test/auth.test.ts: origin normalisation and refusals, cookie variant per Host (the LAN host gets non-Secure cookies, localhost keeps __Host- + Secure and refuses the unprefixed cookie), the realtime URL per allowed origin (never reflected otherwise, PAT gets LINORA_REALTIME_URL).