Web UI
Topologies
Section titled “Topologies”- All-in-one (default).
werbot serverserves the UI itself onWERBOT_HTTP_ADDR, next to the API. - Separate web.
werbot webruns on its own host and domain. It serves the UI and proxies the paths/werbot.v1.(the Connect API),/api/(recording replay),/oauth/and/.well-known/(the CLI’s OAuth authorization server) to the server, so the browser sees one origin and no CORS is needed. The server’sSet-Cookiepasses unchanged and becomes a cookie of the web domain.
werbot web keeps no state, never connects to PostgreSQL and does not get WERBOT_SECRET_KEY or WERBOT_DATABASE_URL. Run as many replicas as you need behind an L7 load balancer.
Configure web
Section titled “Configure web”| Variable | Default | Meaning |
|---|---|---|
WERBOT_WEB_ADDR |
:8090 |
Listen address. |
WERBOT_WEB_API_URL |
required | Internal http(s):// address of the server or of its load balancer. |
WERBOT_TRUSTED_PROXIES |
empty | CIDRs of the load balancer in front of web, so the client IP comes from its X-Forwarded-For. |
WERBOT_LOG_LEVEL, WERBOT_LOG_FORMAT |
info, json |
As on the server. |
WERBOT_METRICS_ADDR |
empty (disabled) | Listen address for /metrics. |
WERBOT_WEB_API_URL=http://werbot-server.internal:8080 werbot webTerminate TLS on the load balancer or ingress in front of web. Web removes incoming X-Forwarded-* headers and sends the server exactly one X-Forwarded-For with the client IP it trusts. A proxied request waits up to 5 s for the connection and 30 s for the response headers; a very large recording replay can hit the 30 s limit (503).
/healthz and /readyz serve the load balancer. On SIGTERM /readyz answers 503 and web stops within 10 s. Kubernetes probes: scaling.md.
Configure server
Section titled “Configure server”WERBOT_WEB_EMBEDDED=false: the server serves only the API,/api/,/healthzand/readyz; UI paths answer 404.WERBOT_WEB_URL= the public UI address, for examplehttps://ui.example.com. Links in emails (invites, password resets) use it.WERBOT_PUBLIC_URLstays the server address: gateways build the tunnel address from it. They enroll at--server(WERBOT_GATEWAY_SERVER_URL), and the start command in the UI passes the web domain there (gateway.md).- Put the subnet of the web replicas into
WERBOT_TRUSTED_PROXIESof the server. Otherwise audit and IP rules see the address of web, and an “allowed CIDRs” rule denies everyone. - Open the server HTTP port only to web and the gateways.
WebSocket
Section titled “WebSocket”The web terminal and the live view (web-terminal.md) use WebSockets on /api/terminal and /api/sessions/<id>/live. werbot web proxies them to the server with no setting. Check these in front of web:
- The load balancer passes
UpgradeandConnectionand keeps idle connections at least 60 seconds (scaling.md). - The server accepts a WebSocket only when its
Originequals the origin ofWERBOT_WEB_URL; any otherOrigingets403. Serve the UI from that one origin. A UI reachable at several origins is not supported. - The handshake has the 30 s response-header wait of any proxied request; after it the connection lasts as long as the session.
Failures
Section titled “Failures”- The server is down or times out: web answers
503with{"code":"unavailable","message":"api unavailable"}(on/api/:text/plainapi unavailable), and the UI offers a retry. Each such request adds towerbot_web_upstream_errors_totaland logsupstream error; a request the browser cancels is not counted. /readyzof web does not depend on the server, so the load balancer keeps the UI in rotation while the API is down.- A load balancer between web and the server that answers
502or504looks the same to the UI: “unavailable”.
Versions
Section titled “Versions”The UI compares its version with the server version and shows a banner when they differ. Upgrade web and the server together: upgrading.md.
Example
Section titled “Example”The web service (two replicas behind nginx) of deploy/docker-compose.cluster.yaml: scaling.md.