Skip to content

Websites

Every Computer serves a website at its own HTTPS address, such as https://my-site.heaven.dev. It's private until you share it: only people with access to the Computer can open it.

Website access

#

A website starts Private. Its owner can open it to the organization or to everyone, if the organization's external sharing setting allows Public.

SettingAudience
PrivatePeople with access to the Computer, and visitors with a share link.
Everyone in acme (organization)Also every signed-in member of the organization.
PublicAnyone on the internet.

Change it in the Computer's Sharing tab.

heaven website my-site --access organization
heaven access my-site

Reference: Set who reaches the website, Read who has access.

#

A share link opens a private website for anyone who has it, without a Heaven account. Its owner can create one if the organization's external sharing setting allows it. In the Sharing tab, choose New link, and set how long it lasts and how many browsers can use it.

heaven share link add my-site --expires 1d --max-uses 5

Heaven shows the link once. It lasts 30 days unless you set otherwise.

Reference: Create a share link.

#

Revoking a link also signs out everyone who opened the website with it. Choose Revoke in the link's menu in Sharing, or pass its ID, from heaven access, to the CLI.

heaven access my-site
heaven share link remove my-site LINK_ID

Reference: Read who has access, Remove a share link.

HTTP and TLS

#

Heaven handles HTTPS and forwards each request to the app over plain HTTP/1.1, WebSockets included. The app must listen on 0.0.0.0, not only on 127.0.0.1. Requests carry X-Forwarded-Proto: https and the original host in X-Forwarded-Host, for building URLs and redirects.

Website port

#

The website serves the port the image sets, 8000 on the default image. The owner can point it at another port, even while the Computer is stopped: in the Networking tab, open the Website row's menu and choose Change port.

heaven website my-site --port 8080

Use --port 0 to restore the image's default.

Reference: Set who reaches the website.

Development ports

#

Every port from 3000 to 9999 is also served over HTTPS at the Computer's address. A dev server on port 5173 is at https://my-site.heaven.dev:5173. Only people with Site and SSH access can open these ports, whatever the website's audience. Port 6080 is the browser desktop. For other protocols, use SSH port forwarding.

Signed-in visitors

#

Your app can tell who is visiting from the headers Heaven adds. A visitor who came through a share link without signing in is anonymous.

HeaderWhen Heaven sends it
X-Heaven-User-IdThe visitor has a Heaven browser session for the site or sends a valid site token.
X-Heaven-EmailThe visitor has a Heaven browser session for the site and a verified primary email address.

Heaven removes any X-Heaven- headers a visitor sends, so the app can trust them on requests that come through Heaven. If the app also takes connections from elsewhere, trust them only on Heaven's.

Site tokens

#

A site token lets a program, such as a test runner or a webhook, open one Computer's private website with your access. Create one from the CLI. Heaven shows it once.

heaven ssh-key add --computer my-site --label preview

Send it in the X-Heaven-Authorization header, or as the password with any username in a client that only does basic authentication.

curl https://my-site.heaven.dev/ -H "X-Heaven-Authorization: Bearer $SITE_TOKEN"

To revoke it, remove its key in Settings → SSH & API keys or with heaven ssh-key remove KEY_ID.

Reference: Add an SSH key, Remove an SSH key.