[LEVEL 1] Local HTTPS with caddy and self signed certificates

Local HTTPS with caddy and self signed certificates

Let’s assume silverbullet is running on 192.168.1.69:3000 on your local network

Step 1.: Let’s install caddy

sudo apt update
sudo apt install caddy

Step 2. Create or edit your Caddyfile (usually in /etc/caddy/Caddyfile)

sudo nano /etc/caddy/Caddyfile

Delete or comment out everything inside the file and add:
(replace with your own IP address in both places), notice in the first line the - and . in second line.

{
    local_certs
}

silverbullet.192-168-1-69.nip.io {
    reverse_proxy 192.168.1.69:3000
}

Press:

  • Ctrl-o to Write file
  • Enter to confirm filename
  • Ctrl-x to quit nano

Step 3. Restart Caddy Service

sudo systemctl restart caddy

Step 4. Now navigate to

https://silverbullet.192-168-1-69.nip.io

Of course replace 192-168-1-69 with your IP address

When accessing the first time, your browser might warn you that the connection is not secure or something similar (this is because it’s a self signed certificate).

Just click “Advanced” and choose Proceed to silverbullet...

:white_check_mark: Done, from now when you access silverbullet through the link you will have https connection to your silverbullet.

I tried using this guide to deploy on my raspberry pi.
I have to to install caddy using the instruction on Install — Caddy Documentation
which is no problem at all.
However, after the installation I'm getting an error when loading silverbullet.

Error: Failed to register a ServiceWorker for scope

Apparently this is due to my browser not trusting the server.

I have to fix it by getting and trusting the root.crt generated by caddy to the client system.

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

after which, silverbullet works as normal.