Share boxes at your own domain
Open shared boxes at your own domain, behind Cloudflare Access, for people without the CLI
When you share a box, a teammate can already open it at
https://box-<id>.tesser.review/ (other ports at
box-<id>--<port>.tesser.review) after signing in to Tesser. A share
gateway puts shared boxes on your own domain instead, such as
https://box-<id>.share.example.com/, for people with no Tesser account: a
designer, a client, a phone. Cloudflare Access decides who can open them.
The gateway is a Cloudflare Worker in your own Cloudflare account. Boxes connect out to it, so nothing reaches into the network they run in, and the Worker holds no secret.
What viewers get
Pick the host
Boxes hang off one host, <host>, and each box takes one label in front of
it. Cloudflare’s free certificate covers a zone’s apex and one level below
it, so:
Set it up
You need a Cloudflare zone for <host> and Zero
Trust on the same account
(the free plan covers 50 users).
https://<host>/__tesser/health answers ok once the Worker is live. Share
a box with tesser share <box> and open the gateway address it prints.
How it works
The dev server sees what it sees on a laptop: each request arrives as
http://localhost:<port>, so Vite’s allowedHosts and Next’s
allowedDevOrigins need nothing added. The gateway adds a small script to
each page that sends the page’s fetch, XMLHttpRequest, WebSocket, and
EventSource calls, links, and forms aimed at localhost:<port> through the
gateway, and redirects to localhost:<port> come back as gateway addresses.
Image, stylesheet, and other resource URLs aimed at localhost:<port> are
rewritten the same way, including ones the page’s scripts add later.
The ports a page can reach this way are the box’s own declared ports plus
the ports it reaches through its dependencies: each [deps] port on the box,
and the ports of the boxes behind them, followed down the dependency chain.
That chain only passes through the boxes of the person who shared the box
and the org’s shared instances. A port served by another member’s own box is
not reachable, and the gateway answers 404 for it. After a tesser wire
changes the box’s dependencies, the reachable ports update on their own.
Each port’s site keeps its own cookies, where localhost shares them across
ports, and a third-party sign-in only returns to a gateway address if the
provider allows it as a callback.