element-hq/element-desktop

Element-desktop tries to reach standard https port (443) even when homeserver I choose has a different port specified

Closed this issue · 3 comments

Steps to reproduce

  1. Run any matrix server on a port other than 443 (For example: 16443), with HTTPS.
  2. Launch element-desktop with parameter "--ignore-certificate-errors" to ignore cert errors.
  3. Enter homeserver address (as in: domain:16443) when asked.

Outcome

What did you expect?

Element desktop only reaches out to port 16443 to communicate with homeserver.

What happened instead?

Element desktop reaches out to both port 16443 and port 443 to communicate with homeserver, resulting in two different certificates error logged in terminal window:

Element desktop logs to terminal, showing three certificate errors on connecting to homeserver, the one in the middle is not on my homeserver, but on my broadband router, which shouldn't even be contacted on communicating with homeserver

The screenshot shows three certificate errors on connecting to homeserver, the 1st and the 3rd one is identical, but the one in the middle is not on my homeserver, but on my broadband router (hence "mediarouter.home" Common Name and "Huawei Technologies" Organization), which shouldn't even be contacted on communicating with homeserver.

Operating system

Debian testing

Application version

Element Desktop 1.11.66

How did you install the app?

Adding packages.element.io to apt sources.list file

Homeserver

conduit 0.7.0 but should not matter, this problem should be able to be replicated even if no homeserver is being run, only nginx is enough

Will you send logs?

No

A similar issue exists on Element Android but is somewhat more explicit since I was asked to trust TWO self-signed certificates on setup and I can only recognize one being the certificate I use on my homeserver.

What did you expect?
Element desktop only reaches out to port 16443 to communicate with homeserver.

If you do not specify protocol (https://) then it'll treat it as a domain to autodiscover as documented in https://spec.matrix.org/v1.10/client-server-api/#well-known-uri where the port is fixed to 443 hence the additional request. If you explicitly specify https://<domain>:<port> then autodiscovery will not be preferred. This is behaving as designed.