matrix.example.com { handle /.well-known/matrix/server { header Content-Type application/json respond `{"m.server": "matrix.example.com:443"}` } handle /.well-known/matrix/client { header Content-Type application/json respond `{"m.homeserver": {"base_url": "https://matrix.example.com"}}` } handle_path /_matrix/* { reverse_proxy localhost:6167 } handle { reverse_proxy localhost:8080 } log { output file /var/log/caddy/matrix.log { roll_size 10MB roll_keep 10 } } } matrix-federation.example.com:8448 { reverse_proxy localhost:6167 }