Librem Chat: the librem.one webserver doesn't host the Client-Server API's well-known URI for server discovery

The domain part of all Matrix user IDs at Librem Chat’s homeserver is librem.one, but the actual hostname of the homeserver is chat.librem.one instead. Therefore, the “Server Discovery” feature of Matrix is necessary for both clients and other homeservers to be able to find the correct hostname of any Librem Chat user’s homeserver.

Currently, there is an SRV record named _matrix._tcp.librem.one present in the DNS, and its target is chat.librem.one. This makes the Server Discovery feature work correctly for other homeservers federating with Librem Chat’s homeserver, according to the “Resolving server names” section (i.e. section 2.1) of Matrix’s Server-Server API specification.

By contrast with the Server-Server API, though, the “Server Discovery” section (i.e. section 3) of Matrix’s Client-Server API specification does not say that Matrix clients should use DNS SRV records for server-discovery purposes. (In fact, the Client-Server API specification doesn’t mention SRV records at all.) Instead, it says that the /.well-known/matrix/client Well-Known URI should be used for client-to-server Server Discovery instead.

However, the web server at librem.one isn’t hosting anything at its /.well-known/matrix/client URL – i.e. you’ll currently get a 404 Not Found error if you try to retrieve that URL. Consequently, it’s not possible for a Librem Chat user to log in using many/most Matrix client apps unless they manually enter in both their user ID (whose domain part is librem.one) and the chat.librem.one hostname separately; otherwise, they’ll get an error message, because the client will try to use librem.one (instead of chat.librem.one) as the hostname of the homeserver.

(For example, nheko will give an error message that says "The required endpoints were not found. Possibly not a Matrix server. in this scenario, and then will need to manually enter chat.librem.one into the “Hostname” field on the login screen in order to log in successfully. Similarly, in SchildiChat, the user will not be able to log in to Librem Chat using the “Sign in with Matrix ID” option on the login screen; they’ll need to use the “Custom server” option instead.)

Also, the web server at librem.one isn’t hosting anything at its /.well-known/matrix/server Well-Known URI for server-discovery by other homeservers that’s specified in the aforementioned part of Matrix’s Server-Server API specification as an alternative to the use of a DNS SRV record. This currently doesn’t cause any problems (because in the absence of that Well-Known URI, homeservers will “fall back” to using the DNS SRV record for server-discovery instead), but someone in nheko’s issue tracker warned that “Matrix Spec may be removing the entire SRV support” in the future (see MSC3922 – i.e. pull-request 3922 in the matrix-org/matrix-spec-proposals repo on GitHub – for more details about this).

(Incidentally, the webserver at chat.librem.one actually does host the correct JSON data for server discovery at its /.well-known/matrix/client URL. But, because the domain part of all Matrix user IDs at Librem Chat’s homeserver is librem.one rather than chat.librem.one, that URL won’t be used by a Matrix client when a user whose user ID’s domain is librem.one tries to log in.)

3 Likes

Random question: Would the Matrix client support and respect an HTTP redirect if librem.one redirected to the same path but on chat.librem.one?

1 Like

i’m trying to connect to the librem one matrix server today for the first time. i’m trying to use thunderbird. unfortunately, thunderbird seems to be completely flummoxed by this issue. it does not provide a way to specify a matrix id (@username:domain1.tld1) and a matrix server host domain2.tld2 where domain1.tld1 and domain2.tld2 are not identical. if i enter @xyz:foo.bar in the field for the matrix id, it replaces this by just xyz and moves foo.bar to the field for the server host, overwriting anything that was there before. looking inside the thunderbird profile, it does not seem that there is a pref setting for the server host which could be different from the domain inside the matrix id.

@joao.azevedo, can you possibly arrange for a fix? it seems that all that is needed is to make available the json object {"m.homeserver": {"base_url": "https://chat.librem.one"}} at the url https://librem.one/.well-known/matrix/client. this can be copied from the same path on chat.librem.one.

3 Likes

For what it’s worth: just now, I tried logging in using NeoChat, and – similarly to Thunderbird (but unlike nheko and SchildiChat) – it also does not have a field to enter in the homeserver’s hostname separately from the user’s Matrix ID, as far as I could tell. So it seems like this problem is likely to break compatibility with a fair amount of Matrix client apps.

(Eventually, I was seemingly able to get NeoChat to log in, but only when I entered in @ixaiqeno:chat.librem.one as my Matrix ID – instead of the real one, which is @ixaiqeno:librem.one – and this workaround might not work correctly on other client apps.)

2 Likes

I have added https://librem.one/.well-known/matrix/client now.

2 Likes