Skip to content

Self-hosting

Put Caddy in front

Terminate TLS with Caddy and forward to Vukem Video, with the settings that make the server trust the proxy.

Last updated:

You will learn#

  • how to give Vukem Video a public https address with Caddy;
  • the three settings the server needs to trust the proxy;
  • how to check it.

The idea#

Network mode requires TLS. You can give the server a certificate directly (TLS_CERT_FILE and TLS_KEY_FILE), or put a reverse proxy in front. The recommended proxy is Caddy: it gets and renews certificates by itself. The product documents Caddy only.

The server accepts a request as https only when the request comes from an address in TRUSTED_PROXIES, TRUST_FORWARDED_PROTO is true and the proxy sent X-Forwarded-Proto: https. A request that claims http through that header is refused, whoever sends it.

Quick start#

A Caddyfile for a server on the same machine as Vukem Video:

Text
video.example.com {
	reverse_proxy 127.0.0.1:7878
}

Caddy sends X-Forwarded-Proto and the client address on its own. Start Vukem Video with:

Terminal
export VUKEM_VIDEO_MODE=network
export VUKEM_VIDEO_ADDR=127.0.0.1:7878
export APP_URL=https://video.example.com
export APP_KEY="$(cat /etc/vukem-video/app-key)"
export TRUSTED_PROXIES=127.0.0.1
export TRUST_FORWARDED_PROTO=true
vukem-video serve
  • APP_URL is the address people type. The Host and the Origin of every request must equal it.
  • TRUSTED_PROXIES lists the addresses or ranges of the proxy, as the server sees them. If Caddy runs in another container, give that network's range, such as 172.18.0.0/16.
  • With the proxy on the same machine, bind the server to loopback so only Caddy can reach it. In a container, publish 127.0.0.1:7878:7878 and set APP_URL to the public address.

Check the address, then the health route:

Terminal
curl -fsS https://video.example.com/up

Common mistakes#

  • Forgetting TRUSTED_PROXIES: every client then shares one rate-limit address, and the server logs a warning. Behind a proxy, the failed-login limit would lock everyone out at once.
  • An APP_URL with http and a public name: refused at start-up. The plain-HTTP exception is only localhost or 127.0.0.1.
  • Letting the proxy rewrite the Host header. Keep the default, which forwards the original host.
  • Using another web server. Only Caddy is documented and tested.

Next steps#