To setup Etke’s Matrix service, you will need to reverse-proxy or redirect to certain endpoints.

Assuming your matrix is on matrix.example.com and website on example.com, your Caddyfile will look like this:

https://example.com {
	root /var/www/html
	file_server
	encode gzip zstd
	
	redir /.well-known/matrix/* https://matrix.example.com{uri} permanent
}

With this, the Matrix endpoints will point to the right locations.