Skip to content

HTTPS and Your Domain

Scope: why a vault server needs a real name and a real padlock, what the DOMAIN setting actually does, and the reverse proxy that provides both — proven in the lab with nginx and a self-signed certificate, with the public certificate part documented.

Why the padlock is load-bearing

For most home services, HTTPS is a nicety. For this one it is structural, twice over.

First, the web vault does cryptography in the browser — the key stretching of chapter 3 runs in the page, using the browser's Web Crypto API. Browsers only expose that API in a secure context: an https:// page, or http://localhost on your own machine. Serve the web vault over plain HTTP at a network address and the page loads, the login form renders, and the cryptography it needs simply isn't there. Nothing about this is Vaultwarden being fussy; it is the browser platform's rule, and no server setting changes it.

Second, the clients expect it. The phone and desktop apps are built against a world where vault traffic is TLS; a self-signed certificate on a home address is a fight with every client you own, fought again at every renewal of the certificate. The honest summary: a vault you can only reach from your own LAN, with a certificate your devices have been taught to trust, is a workable thing — people run them — but it is the advanced mode, not the default this guide teaches.

What you need, then, is the ordinary public shape: a domain name you control (any subdomain of a domain you own; this guide's specimens use vault.example.test), DNS pointing at your server, and a certificate for that name. The certificate is the part readers expect to hurt. It doesn't, because of the next section.

Vaultwarden doesn't do TLS; a proxy does

The server speaks plain HTTP. That is a design choice, not a gap: TLS termination is a solved problem one layer up, and the server leaves it there. The shape every install converges on:

browser / apps ──HTTPS──► reverse proxy ──HTTP──► Vaultwarden
                            (your domain,            (localhost,
                             a real certificate)      port 8222)

The reverse proxy is a small web server — Caddy or nginx are the usual two — that holds the certificate, answers the public name, and hands each request to Vaultwarden on localhost. Vaultwarden then only ever listens on a local port, which is why the compose example in chapter 2 publishes its port on 127.0.0.1 only.

The lab proved this shape with nginx and a self-signed certificate for vault.example.test (t21): the proxy listened on 8443, passed everything to the server on 8224, and /alive answered through the TLS layer. examples/nginx-vault.conf is that configuration generalised, with the certificate paths pointed at Let's Encrypt — the free, automated authority whose certificates every client already trusts. Getting one (with Caddy, it happens by itself on first run; with nginx, a tool called certbot does it) is documented here rather than proven: the lab's name was invented, and Let's Encrypt quite properly only issues for names that exist. Caddy's whole file is three lines (examples/Caddyfile) for exactly this reason — automatic HTTPS is its reason to exist.

DOMAIN: tell the server its own address

The server cannot guess the address the world uses for it — behind a proxy, all it sees is localhost. So you say it:

DOMAIN=https://vault.example.test:8443

This is not bookkeeping. The server builds the addresses it hands to clients from DOMAIN, and chapter 3's /api/config shows them. Compare two runs of the lab server: without DOMAIN, the config's environment block points at http://localhost (t03); with DOMAIN set to the proxy's address, the same block answers (t21):

{
  "api": "https://vault.example.test:8443/api",
  "identity": "https://vault.example.test:8443/identity",
  "notifications": "https://vault.example.test:8443/notifications",
  "vault": "https://vault.example.test:8443"
}

Invitations, email links, and the clients' own sense of where they live all derive from this. The recurring symptom of a wrong DOMAIN is a server that works from the machine itself and misbehaves for everyone else (chapter 11).

Three proxy details that bite, all in the example file: pass the usual forwarding headers (Host, X-Forwarded-For, X-Forwarded-Proto) so the server logs real addresses and builds links with the right scheme; raise nginx's request-size limit, or large attachments fail; and give /notifications/hub — live sync's WebSocket, served on the same port as everything else in current versions — the upgrade headers it needs, or clients silently fall back to slower polling.

The shape, whole

Domain you own → DNS to your server → proxy with a real certificate → Vaultwarden on localhost, told its own name in DOMAIN. Every client meets only the left-hand side. That is the entire public surface of your vault, and its smallness is a security property chapter 9 will spend.