Documentation
¶
Overview ¶
Command previewfix is the previews browser spec's fixture (e2e/tests/previews.spec.ts): the two processes around the real gateway and the real host that the spec cannot be itself.
previewfix edge -listen 127.0.0.1:<port> -upstream 127.0.0.1:<gateway public port> -log <file>
previewfix app -listen 127.0.0.1:<port>[,127.0.0.1:<port>…] -log <file>
- edge: the TLS edge in front of the gateway's public listener, as the
real deployment's edge is (the gateway speaks plain HTTP and leaves TLS
to the edge). A self-signed certificate made at start for the spec's
zone (the browser runs with ignoreHTTPSErrors), HTTP/1.1 only, and a
reverse proxy that changes NOTHING the gateway reads: the Host, every
Sec-Fetch-* header, Origin and the cookies pass as the browser sent
them, and no X-Forwarded-* is added. It writes one JSON line per
request — what the gateway was sent (the Sec-Fetch-* values, Origin,
the NAMES of the cookies, never their values), the status the gateway
answered (101 for an upgrade) and its refusal code, if any — so the spec reads the real
browser's Fetch Metadata as the gateway saw it.
- app: the "dev server" a mirrored window runs: on each loopback address
it serves a page whose script opens a WebSocket echo (as a dev server's
hot-reload socket does) and an EventSource, the echo and the event
stream themselves, /api/ping, /secret (what a sibling preview must not
reach), and /attack?victim=<url> (a page that loads <url> in a hidden
iframe and opens a WebSocket to <url>'s host /ws: a sibling preview
reaching for another). Every request is one
JSON line in the log: which listener, the method and the path, so the
spec sees what reached an app and what never did.
Every name and value here is invented for the suite; nothing is reached but loopback.