HTTPS in front of Ilexarium

Ilexarium listens on 127.0.0.1 and needs HTTPS in front. One way to do it, with Caddy on the same machine.

Diese Seite ist noch nicht übersetzt, deshalb steht sie hier auf Englisch.

Ilexarium knows nothing about how you reach your server, and that's on purpose: it listens on 127.0.0.1:3000 (set in /etc/ilex/app.env) and leaves the rest to you. Signing in needs HTTPS, because the sign-in sends your Linux password.

Any HTTPS reverse proxy works. Here is one way: Caddy on the same machine, with a name in your home network.

A name for the machine

The examples use ilex.home.arpa. Names ending in .home.arpa are set aside for home networks (RFC 8375): they never exist on the internet, so yours can't clash with anyone's. Your devices still have to learn which machine it is, in one of two ways:

  • In your router, if it lets you add local DNS names (often under "DNS", "Local DNS" or "Hostnames"): point ilex.home.arpa at the machine's address. Every device at home then knows it.
  • On each device, in its hosts file (/etc/hosts on Linux and macOS): a line like 192.168.1.20 ilex.home.arpa, with your machine's address. Phones usually don't allow this.

Give the machine a fixed address in your router first, so the name keeps pointing at it.

Caddy with its own certificate

Install Caddy from your system's packages, then put this in /etc/caddy/Caddyfile:

ilex.home.arpa {
	tls internal
	reverse_proxy 127.0.0.1:3000
}

tls internal makes Caddy create a certificate signed by its own local authority. Your browser will warn until you trust Caddy's root certificate on your devices. With Caddy from your system's packages it's here:

sudo cat /var/lib/caddy/.local/share/caddy/pki/authorities/local/root.crt

Copy it to each device and add it as a trusted certificate authority (in the system's certificate settings, or the browser's).

Reload Caddy:

sudo systemctl reload caddy

A real domain? If the name is yours on the internet and ports 80 and 443 reach the machine from outside, leave out tls internal: Caddy gets a certificate from Let's Encrypt by itself. That opens the sign-in page to everyone: see the reverse proxy way first.

Check it

Open https://ilex.home.arpa (or your name). The sign-in page should load without the warning about an unencrypted connection.