Guillaume Hérail

Ramblings in Frenglish

Caddy as a reverse proxy to Dendrite

Posted on — Jan 12, 2021

I use Dendrite as I experiment with Matrix. It consumes a lot less resources than Synapse though it is in beta and doesn’t support the specification in full. The trade-off suits me.

I wanted to try Caddy for a long time and I just did, switching this blog and a few other services to it. The last one to be migrated was Dendrite. The repository gives an example configuration for nginx but not for Caddy. Here’s what I ended up using:

# delegate to matrix.herail.net
herail.net {
    handle /.well-known/matrix/server {
        respond "{\"m.server\":\"matrix.herail.net:443\"}"
    }

    handle /.well-known/matrix/client {
        respond "{\"m.homeserver\":{\"base_url\":\"https://matrix.herail.net\"}}"
    }
}

# reverse proxy to Dendrite, both :443 and :8448
matrix.herail.net matrix.herail.net:8448 {
    handle /_matrix/* {
        reverse_proxy http://dendrite:8008 {
        }
    }
}

This configuration delegates herail.net to matrix.herail.net and takes care of SSL certificates on its own.

This is day 10/100 of #100DaysToOffLoad!