The Case of my Unfortunate Matrix Server Name
02 Aug 2021I’m new to Matrix: what is an MXID and why is it important?
Matrix is a decentralized communication standard, currently used for (and implemented mainly for) instant messaging. Since it’s decentralized, there is no central server that a client can blindly look up. Thus, the MXID. It’s similar to how email works with user@server.com, but instead, it’s represented as @user:server.com. This is the unique identifier used to identify a user on a specific server, and currently, on Matrix it’s used as the equivalent to a handle. Whenever someone wants to DM you, mention you, or invite you to a room, they type in the MXID. It’s kind of important (but not the end of the world).
The actual server name
My Matrix server, in terms of MXIDs anyway, is referred to as jepcraft.ddns.net:443, making me for example @whodiduexpect:jepcraft.ddns.net:443. Not only is that pretty long to type, but it looks awful too. Unlike the documentation recommends, my server name uses an explicit port. I’m surprised that federation still works, given that I have never seen another server that uses an explicit port. Additionally, being stuck with that ugly No IP DDNS subdomain (to be clear, still recommend if you can’t have a domain) has other caveats. One of them being that I will need to keep maintaining my ownership of it since with the free plan I need to keep confirming the domain every 30 days. Also, I’m depending on No IP to still provide this domain for free. All this trouble when I could have just used a regular domain.
How it happened (and why I am stuck with it)
To be clear, this is the path you do not want to go down. I first set up my Matrix server without ever trying Matrix out or doing much research into it. I found it purely because I had tried setting up IRC, found it a bit too dated, and saw a bunch of talk about Matrix. Heck, I didn’t even know about one of the killer features of it (the whole decentralization and federating with the entire Matrix network thing) until a bit after. I was in a bit of a rush to set it up and obviously didn’t know about the concept of the MXID, so when I was putting in the server name in the configuration file I put a temporary domain there. Since explicitness is usually a good thing I also stuck “:443” (explicitly specifying the HTTPS port) there because I thought that would guarantee encryption (keep in mind I was coming from IRC where encryption is very non-standard). After filling in a few values in the config it worked, and I didn’t hesitate to get everything set up on this newly created instance. I planned to migrate it to an actual domain later, only to later find out the only real migration was nuking the server and starting again, which at that point was just not worth it.
Matrix server admins: how to not mess it up
- Don’t delay getting a “proper” domain set up, you can’t migrate domains or even your server name as a whole (even to remove a dumbly inserted explicit port), if you try to manually replace domains in the database it will break everything
- Use delegation, preferably the .well-known method, to avoid adding subdomains or explicit ports in your server name. Also, you should normally not be specifying any ports in the first place, the default port 8448 works fine for federation, and addressing my encryption concerns, server behavior doesn’t change based on port.