I found it challenging to serve up the .well-known files as part of a matrix messaging installation. Matrix is described here: Introduction | Matrix.org. These servers are federated and they discover each other using either SRV records in DNS or with well known files, for example: https://matrix.org/.well-known/matrix/server.
It took me a while to realize that the redir directive is such high priority. Like many sites I redir all traffic from to www..
I ended up with this caddy configuration for :
http://<DOMAIN>.org {
redir https://www.<DOMAIN>.org{uri}
}
https://<DOMAIN>.org {
route {
reverse_proxy /.well-known/matrix/* https://matrix.<DOMAIN>.org {
header_up Host matrix.<DOMAIN>.org
}
redir https://www.<DOMAIN>.org{uri}
}
}
I failed to puzzle out how to do this with the simplified config file.
Maybe this will be helpful for others.
But, I’m curious if my solution can be improved?