Skip to content

Publish to web

Anyone who can edit a page can share it as a read-only link, from the page’s Share button. The server renders the page as plain HTML, live: readers always see the page as it is now, and unpublishing or making a new link takes the old address down at once. Links are long random tokens, never page IDs. Each page’s options are off until its editor turns them on: its subpages (as a small site), search engines, an expiry date, and a password.

Where published pages live

With no settings, at https://notes.example.com/p/<token>. That works, but readers reach the same host as your app. To keep the app, its API and sign-in private, give published pages a host of their own, which serves nothing but published pages and their files (everything else there is a 404):

[publish]
public_url = "https://pages.example.com"
listen = "0.0.0.0:8443" # a port of its own: published pages only

Then put only that port, or that host name, on the internet:

  • Behind a reverse proxy: route pages.example.com to port 8443 and nothing else, and keep the app’s host on your private network or VPN. Set client_ip_header = "x-forwarded-for" if the proxy sets it, so the per-reader limits see readers rather than the proxy. Without listen, the main port also serves the public host to requests for its name, but a separate port is easier to expose alone.

  • Docker Compose: uncomment [publish] in drusite.toml and the 8443 port in compose.yaml.

  • Kubernetes: the chart’s publish values add the listener, a public Service port and, optionally, an Ingress for the public host alone:

    publish:
    enabled: true
    host: pages.example.com
    ingress:
    enabled: true
    className: public
    tls:
    - hosts: [pages.example.com]
    secretName: pages-tls

TLS without a proxy

The server can serve TLS on the public listener itself, from PEM files. It reads them again when they change, so a renewal by certbot, acme.sh or cert-manager needs no restart:

[publish]
public_url = "https://pages.example.com"
listen = "0.0.0.0:443"
tls_cert = "/etc/drusite/tls/fullchain.pem"
tls_key = "/etc/drusite/tls/privkey.pem"

What readers get

  • Pages rendered by the server, with no JavaScript, in light and dark, on phones too. Every piece of content is escaped, a strict Content Security Policy allows no script at all, Referrer-Policy: no-referrer keeps the link’s token from leaking to sites a page links to, links to pages that aren’t shared become plain text, and no internal ID appears anywhere.
  • A link that doesn’t work (unknown, unpublished, expired, in the trash, a subpage that isn’t shared) gets the same 404 as one that never existed.
  • noindex (in a meta tag and X-Robots-Tag) unless the editor allows search engines, and always while there’s a password. robots.txt never lists links.
  • A password page shows only a form. The password is hashed (argon2id), tries are limited per address and per link, and a reader who knows it gets a signed cookie for that link. A new password or a new link ends those cookies.
  • Cache-Control: private, max-age=15 and an ETag: a reader’s browser may show a page up to cache_secs after it’s unpublished.

Who may publish

A workspace’s editors and owners (viewers and guests can’t). An agent publishes only if its person allowed it (when connecting it, or later in Settings → Agents), and its publishing shows in the agents’ activity. An agent with a token for an encrypted workspace publishes one page at a time, and the server keeps a readable copy of that page, as when a device publishes it.

In an end-to-end encrypted workspace, publishing is a choice to make a readable copy: the editor’s device uploads a plaintext copy of the page to the server, and refreshes it after edits while an editor’s device is online. The app says so before it publishes.

Settings

Key Default
[publish] enabled true false: no new links, and published pages are 404 (editors can still unpublish)
[publish] public_url unset The public host’s origin; links use it
[publish] listen unset The public host’s own port
[publish] tls_cert, tls_key unset PEM files for TLS on that port
[publish] cache_secs 15 How long browsers keep a page
[publish] per_minute 300 Requests a minute from one address
[publish] client_ip_header unset Where a proxy puts the reader’s address

Views of published pages are counted, as a number per day and nothing else, unless [analytics] count_public_views is off.