.well-known redirects

One of the prerequisites for installing Matrix server is proper .well-known setup. This is important for both federation and client apps connectivity.

Here we collect configuration examples for various web servers and platforms to help you set up the necessary redirects.

If you don’t see your web server or platform listed here, please contact us for assistance!

Web Servers¶

Nginx¶

# This is your HTTPS-enabled server for your-server.com.
# Replace your-server.com with your Matrix server's base/apex domain.
server {
	server_name your-server.com;

	location /.well-known/matrix {
        rewrite ^/(.*)$ https://matrix.your-server.com/$1 permanent;
	}

	# other configuration
}

Apache2¶

# This is your HTTPS-enabled server for your-server.com.
# Replace your-server.com with your Matrix server's base/apex domain.
<VirtualHost *:443>
	ServerName your-server.com

    Redirect 301 /.well-known/matrix https://matrix.your-server.com/.well-known/matrix

	# other configuration
</VirtualHost>

Caddy 2¶

# This is your HTTPS-enabled frontend for your-server.com.
# Replace your-server.com with your Matrix server's base/apex domain.
your-server.com {
    redir /.well-known/matrix/* https://matrix.your-server.com{uri} permanent

	# other configuration
}

Platforms¶

Vercel¶

official documentation

Configured in vercel.json, replace your-server.com with your Matrix server base/apex domain:

{
  "redirects": [
    {
      "source": "/.well-known/matrix/server",
      "destination": "https://matrix.your-server.com/.well-known/matrix/server",
      "statusCode": 301
    },
    {
      "source": "/.well-known/matrix/client",
      "destination": "https://matrix.your-server.com/.well-known/matrix/client",
      "statusCode": 301
    },
    {
      "source": "/.well-known/matrix/support",
      "destination": "https://matrix.your-server.com/.well-known/matrix/support",
      "statusCode": 301
    }
  ]
}

Don't have a Matrix server yet?

We specialize in setup, hosting and maintenance of Matrix and various Matrix & non-Matrix add-ons.
Hosting is on affordable VPS servers provided by us (via Hetzner Cloud) in the EU, US and Asia, or on your own infrastructure anywhere in the world.

Let's build your Matrix haven together!

Order Now