MessageWeave/docs
anonsaber 34efae84ff feat(status): derive `backend` from the request Host header, not a startup env
The previous round (88f0923) threaded a `backend_id` from `BACKEND_ID`/`HOSTNAME`
env vars into `AppState`. That required the operator to manually align each
instance's `BACKEND_ID` with the Cloudflare Worker's `BACKEND_ORIGINS_JSON`, which
is exactly the kind of manual cross-config sync that drifts.

The request's own `Host` header already carries the answer: the Worker load
balancer (`ARCH-LB-WORKER`) preserves the inbound `Host` while rewriting the target
to a backend origin (`joinUrl` builds `origin + path + query`), so `Host` is the
public address the LB routed this instance as. `backend_label_from_headers` reads
it per-request in `setup_status`, trims the default https/http port
(`example.com:443` -> `example.com`) so the label mirrors a bare origin, and returns
`None` when the request carries no usable `Host`.

This removes the startup env entirely — `backend_id_from_env`, `AppState::backend_id`,
all five router-builder `backend_id` parameters, the `.env.example` `BACKEND_ID`
entry, and the `BACKEND_ID` env documentation are all gone. Handlers still never
touch the environment: `Host` is request-scoped, not process-global, so there is no
test race (the `debug_surface_requested` rationale was about env, not headers).

Tests: `setup_status_reports_backend_label` now sends `Host: edge-1.example.com:443`
and asserts the label is the bare origin `edge-1.example.com` (port trimmed). A new
`setup_status_reports_null_backend_without_host` asserts `null` when no Host is sent.
GATE-P0 106 passed / 0 failed / 4 ignored; GATE-DOCS 6/6 clean (49 line-refs).
2026-10-14 08:48:11 +08:00
..
charter.md feat(status): derive `backend` from the request Host header, not a startup env 2026-10-14 08:48:11 +08:00
charter.zh-CN.md feat(status): derive `backend` from the request Host header, not a startup env 2026-10-14 08:48:11 +08:00
design.md feat(status): derive `backend` from the request Host header, not a startup env 2026-10-14 08:48:11 +08:00
design.zh-CN.md feat(status): derive `backend` from the request Host header, not a startup env 2026-10-14 08:48:11 +08:00
opengaps.md feat(status): derive `backend` from the request Host header, not a startup env 2026-10-14 08:48:11 +08:00
opengaps.zh-CN.md feat(status): derive `backend` from the request Host header, not a startup env 2026-10-14 08:48:11 +08:00
reference.md feat(status): derive `backend` from the request Host header, not a startup env 2026-10-14 08:48:11 +08:00
reference.zh-CN.md feat(status): derive `backend` from the request Host header, not a startup env 2026-10-14 08:48:11 +08:00
retired.md feat: immediate push trigger + inline /help + RFC 8620 push verification fix 2026-10-12 22:18:29 +08:00
retired.zh-CN.md feat: immediate push trigger + inline /help + RFC 8620 push verification fix 2026-10-12 22:18:29 +08:00