element-x-android icon indicating copy to clipboard operation
element-x-android copied to clipboard

Server must be using .well-known to be discovered

Open turt2live opened this issue 2 years ago • 1 comments

Steps to reproduce

  1. Open the app for the first time
  2. Try to set up an account on not-matrix.org
  3. Enter server domain name
  4. No error or feedback
  5. Set up .well-known/matrix/client
  6. Update the server name field
  7. Results!

Outcome

What did you expect?

Either an error or something to suggest that my chosen server name might not work

What happened instead?

image

Your phone model

No response

Operating system version

No response

Application version and app store

No response

Homeserver

No response

Will you send logs?

No

Are you willing to provide a PR?

No

turt2live avatar Aug 17 '23 19:08 turt2live

~I have the same issue. I use traefik and I can't serve .well-known~

Nevermind it's ok using serve_server_wellknown: true

Mateleo avatar Oct 07 '24 17:10 Mateleo

hello, I have the same problem

I use Docker with Synapse 1.116 Image is matrixdotorg/synapse:latest

I have an Nginx proxy manager for the domain that does SSL/https

in the homeserver.yml it says x_forwarded: true

when I call the domain in the browser it says: It works! Synapse is running

I can log in normally in the Windows app for Elements and get no .well-known error, when I try with the Android app I get a .well-known error

when I try with the Element X app I can log in just fine

so I rule out a server issue otherwise I would have the same error in Windows as I did in the Element X app

I only noticed the error because my wife got a new phone and I had to log in to the server again, everything was fine on my phone until I logged out to test and before that there were no .well-known errors either but now there is

when I look in the docker log it says

2024-10-11 11:51:18,331 - synapse.access.http.8008 - 473 - INFO - GET-7 - 0.0.0.0 - 8008 - {None} Processed request: 0.001sec/0.000sec (0.001sec, 0.000sec) (0.000sec/0.000sec/0) 61B 404 "GET /.well-known/matrix/client HTTP/1.1" "Element/1.6.20 (samsung SM-S918B; Android 14; UP1A.231 005.007.S918BXXS6CXGA; Flavor GooglePlay; MatrixAndroidSdk2 1.6.20)" [0 dbevts] how can I fix this

TheMockTv avatar Oct 11 '24 09:10 TheMockTv

I fixed it, I found a post on Reddit

I had to enter this in my homeserver YAML public_baseurl: https://your matrix domain matrix_synapse_federation_enabled: true

this allowed me to log in again with the elements app

on the https://federationtester.matrix.org/api/report?server_name=your main domain not the matrix domain

this allows you to test your server to see if it accepts the well known function

TheMockTv avatar Oct 11 '24 10:10 TheMockTv

@TheMockTv I am seeing the problem even with the settings you mentioned. I can see "GET /.well-known/matrix/client HTTP/1.1" in my httpd logs and when I visit that URL in a browser, it returns the correct and expected JSON. I am able to log in fine with other clients. It is only the Android app that gives me an error.

The federation tester shows my server to be working normally.

Any ideas?

snex avatar Sep 08 '25 19:09 snex

@TheMockTv I am seeing the problem even with the settings you mentioned. I can see "GET /.well-known/matrix/client HTTP/1.1" in my httpd logs and when I visit that URL in a browser, it returns the correct and expected JSON. I am able to log in fine with other clients. It is only the Android app that gives me an error.

The federation tester shows my server to be working normally.

Any ideas?

Could you add the contents of that file, redacted, if you want? Maybe there's something in the format or the fields that the SDK believes is invalid and discards the whole config.

jmartinesp avatar Sep 09 '25 07:09 jmartinesp

@snex

Hi,

Before we can help you, please share more details about your setup:

Are you using Docker or a direct installation?

Do you have a reverse proxy in front (e.g., Nginx, Traefik)?

Which domains are you using (please anonymize them, e.g., matrix.example.org)?

Share the relevant part of your homeserver.yaml – without passwords, secrets, or API keys.

Show the responses from your /.well-known/matrix/client and /.well-known/matrix/server endpoints.

If you have a proxy config, please include the relevant location blocks (no private info).

Important: YAML is very sensitive to indentation and syntax. Even a single incorrect space or wrong indentation can cause Synapse to fail or block connections.

With this information, we can better diagnose if the issue is related to your configuration.

Thanks!

TheMockTv avatar Sep 09 '25 15:09 TheMockTv

I figured the problem out.. the JSON I was returning in response to the .well-known/matrix/client request was

{
  "base_url": "https://some.server"
}

This used to work and seems to work on some clients, but the android client will only work in this format:

{
  "m.homeserver":
  {
    "base_url": "https://some.server"
  }
}

snex avatar Sep 09 '25 15:09 snex

I'm closing this since the issue is pretty old and new issues with the same behaviour should be reported separately so they're easier to track.

jmartinesp avatar Sep 10 '25 07:09 jmartinesp