content

How to remove the subdomain from a matrix server name

Say for example you host matrix at matrix.example.com and you want the matrix server name to simply be example.com. To do this, you need to re-host the .well-known files at the desired domain. 1

For example, if you are using Apache web server you can add an .htaccess file which redirects all requests to the .well-known folder to the matrix subdomain: 1

Redirect 301 /.well-known https://matrix.example.com/.well-known
Header always add Access-Control-Allow-Origin: "*"

Note that the Access-Control-Allow-Origin has to be included, otherwise federation will not work. 2

meta

tags: matrix

created:

backlinks: Matrix federation fails because .well-known is served with the incorrect CORS headers

commit: 4abd4cbd