Help center/Self-hosting

ARTICLE / Self-hosting

Reverse proxy and HTTPS

The sync server speaks plaintext on loopback, so HTTPS must come from a reverse proxy: Caddy, Tailscale, a temporary tunnel, or a self-signed certificate with an installed CA.

Four ways to get TLS

PathRequiresPrivacyUse for
A. Domain + Caddy auto-certificatesA domain + reachable 80/443Good (only your own machines)Recommended; set up once, runs forever
B. TailscaleTailscale on both endsBest (P2P, no third party relays content)No domain, or you would rather not open ports
C. Cloudflare quick tunnelcloudflared installedModerate (a third party sees ciphertext and token traffic)One-off acceptance checks only
D. LAN + self-signed certificateNothingGoodFully offline; but the phone must install the CA — the fussiest
cloudflared tunnel --url http://127.0.0.1:5180

Path C gives a temporary https://<random>.trycloudflare.com domain — trusted HTTPS with zero configuration, fine for "just confirm it works on my phone once". Cloudflare sees ciphertext, keywrap and token traffic, never plaintext. The temporary domain is publicly reachable — shut it down right after checking.

The Caddyfile, in full

The repo has exactly this one reverse-proxy sample, shared by containers and bare metal (the only difference is the NOVARA_UPSTREAM environment variable). The comments keep the "why":

{$NOVARA_DOMAIN:novara.example.com} {
	encode zstd gzip

	# No public hostname? Uncomment to have Caddy issue itself a certificate.
	# tls internal

	reverse_proxy {$NOVARA_UPSTREAM:127.0.0.1:5180} {
		header_up X-Forwarded-Proto {http.request.scheme}
		header_up X-Forwarded-Host {http.request.host}
	}

	header {
		X-Content-Type-Options nosniff
		X-Frame-Options DENY
		Referrer-Policy no-referrer
		X-Robots-Tag "noindex, nofollow, noarchive"
		Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; connect-src 'self'; manifest-src 'self'; worker-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'; object-src 'none'"
	}
}

Only one thing to change: the domain on the first line. The two header_up lines are the basis for every absolute URL the server emits — without them, the /web redirect would point at the internal listen address. When switching to another reverse proxy, you must reproduce these two forwarded headers.

Self-signed means installing the CA

With LAN self-signing (Caddy tls internal) the phone must trust that root certificate; otherwise the page is not a secure context, crypto.subtle is not exposed at all — and "continue anyway" will not help.

  • The root certificate lives in Caddy's data directory at pki/authorities/local/root.crt (Windows: %AppData%\Caddy\; Linux: ~/.local/share/caddy/).
  • iOS: after installing the profile under Settings → General → VPN & Device Management, you must also enable full trust in "About → Certificate Trust Settings" — the step most often missed.
  • Android: Settings → Security → Encryption & credentials → Install a certificate → CA certificate.
  • Access by domain, not IP — the certificate is bound to the domain.

If those steps feel like too much, pick path A or B.

TRUSTED_PROXIES: unset = 403 on every request

Proxies on the loopback are trusted by default, no configuration needed. The Compose deployment's default already includes the Caddy container address 172.28.0.250 and the gateway 172.28.0.1. The server judges the scheme after forwarded headers take effect, so an untrusted proxy cannot claim an HTTPS it does not actually provide.