25 lines
1.2 KiB
Markdown
25 lines
1.2 KiB
Markdown
# Flutter web preview
|
|
|
|
Build and run from `app/`:
|
|
|
|
```sh
|
|
/Users/alan/development/flutter/bin/flutter build web
|
|
UPSTREAM=http://127.0.0.1:8095 node tool/preview/server.mjs --port 8096
|
|
```
|
|
|
|
The preview binds to loopback by default and authenticates static requests by
|
|
checking the upstream authenticated web proxy with the browser cookie. Unauthenticated
|
|
HTML navigation goes to the proxy's `/login?next=...`; unauthenticated assets and
|
|
WebSocket upgrades are refused. Login, logout and artifacts are streamed to the
|
|
proxy without decoding compressed response bodies. `/connect` accepts only a
|
|
same-origin browser Origin, checks the cookie, then maps Origin and Host to the
|
|
configured upstream origin before upgrading. HTTP and HTTPS upstreams are
|
|
supported using Node's normal TLS certificate verification. Set `UPSTREAM` to
|
|
the authenticated proxy, never the raw control server. The root path and files
|
|
must exist locally, and only GET, HEAD, and POST are supported. Tests use
|
|
isolated loopback fixtures and port 0.
|
|
|
|
The persistent preview API is `start({ root, upstream, host, port })` from
|
|
`tool/preview/server.mjs`; it resolves to `{ server, port, close }`. Call
|
|
`close()` to stop accepting requests and close tracked upgraded sockets.
|