Skip to content

I can't login to any homeserver at all: "We couldn't reach this homeserver" #3447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ImMALWARE opened this issue Sep 11, 2024 · 25 comments · May be fixed by #4744
Open

I can't login to any homeserver at all: "We couldn't reach this homeserver" #3447

ImMALWARE opened this issue Sep 11, 2024 · 25 comments · May be fixed by #4744
Labels
T-Defect Something isn't working: bugs, crashes, hangs and other reported problems

Comments

@ImMALWARE
Copy link

Steps to reproduce

  1. I download latest version from GitHub Releases
  2. Opened the app, click continue
  3. Why not matrix org, continue

Outcome

What did you expect?

Login and password prompt

What happened instead?

We couldn't reach this homeserver. Please check that you have entered the homeserver USL correctly. If the URL is correct, contact your homeserver administrator for further help.

No matter what homeserver I try to login, it always gives this error

Your phone model

POCO X5 Pro 5G

Operating system version

Android 14

Application version and app store

Element X 0.5.3

Homeserver

I tried a lot of homeserver, none worked, even matrix.org

Will you send logs?

Yes

Are you willing to provide a PR?

No

@ImMALWARE ImMALWARE added the T-Defect Something isn't working: bugs, crashes, hangs and other reported problems label Sep 11, 2024
@ImMALWARE
Copy link
Author

@frebib
Copy link
Contributor

frebib commented Sep 12, 2024

You have an invalid global HTTP proxy set on your phone according to those logs. Try disabling it

@ImMALWARE
Copy link
Author

You have an invalid global HTTP proxy set on your phone according to those logs. Try disabling it

Umm? What proxy? I was connected to mobile data, no proxy is set up in Mobile APN settings. Now I'm connected to Wi-Fi. No proxy is set up in Wi-Fi network's settings. No VPNs are enabled. I also had AdAway installed, I disabled it, it didn't help, still getting same error. No issues with any other app, including Element (not x)

@frebib
Copy link
Contributor

frebib commented Sep 12, 2024

Specifically I'm talking about the :0 proxy here
Many others have had this same issue such that it's a reasonably well understood problem now:

2024-09-11T23:44:38.139385Z DEBUG elementx: Using global proxy | 
2024-09-11T23:44:38.142840Z  INFO matrix_sdk::http_client::native: Setting the proxy for the HTTP client proxy_url=":0" | crates/matrix-sdk/src/http_client/native.rs:176 | spans: build{homeserver=ServerNameOrHomeserverUrl("https://matrix.org")}

@ImMALWARE
Copy link
Author

Specifically I'm talking about the :0 proxy here Many others have had this same issue such that it's a reasonably well understood problem now:

2024-09-11T23:44:38.139385Z DEBUG elementx: Using global proxy | 
2024-09-11T23:44:38.142840Z  INFO matrix_sdk::http_client::native: Setting the proxy for the HTTP client proxy_url=":0" | crates/matrix-sdk/src/http_client/native.rs:176 | spans: build{homeserver=ServerNameOrHomeserverUrl("https://matrix.org")}

Oh, is it issue with my android settings or with element x app?

@frebib
Copy link
Contributor

frebib commented Sep 12, 2024

Probably your OS settings

@ImMALWARE
Copy link
Author

Probably your OS settings

How do I disable that proxy?

I was connected to mobile data, no proxy is set up in Mobile APN settings. Now I'm connected to Wi-Fi. No proxy is set up in Wi-Fi network's settings. No VPNs are enabled. I also had AdAway installed, I disabled it, it didn't help

@ImMALWARE
Copy link
Author

ImMALWARE commented Sep 13, 2024

Probably your OS settings

Wait, doesn't ":0" mean "no proxy"?
image
image

@frebib
Copy link
Contributor

frebib commented Sep 15, 2024

@532910
Copy link

532910 commented Jan 21, 2025

can confirm this issues with SAMSUNG SM-N910T on Android 14
I believe it's not related to some proxy settings as I have not found nothing in logcat

@ImMALWARE
Copy link
Author

ImMALWARE commented Jan 21, 2025

can confirm this issues with SAMSUNG SM-N910T on Android 14 I believe it's not related to some proxy settings as I have not found nothing in logcat

open termux, enter "su" and execute commands:

settings delete global http_proxy
settings delete global global_http_proxy_host
settings delete global global_http_proxy_port

@532910
Copy link

532910 commented Jan 21, 2025

no root on that phone

@532910
Copy link

532910 commented Jan 21, 2025

that phone succesfully downloads well-known from my homeserver

@532910
Copy link

532910 commented Jan 21, 2025

not fixed, please reopen

@ImMALWARE
Copy link
Author

ImMALWARE commented Jan 23, 2025

@532910, can you try to do the same thing via adb shell from pc?

@532910
Copy link

532910 commented Jan 23, 2025

it was done from pc

@ImMALWARE
Copy link
Author

@532910, maybe factory reset?...

@532910
Copy link

532910 commented Jan 23, 2025

no way

@ImMALWARE
Copy link
Author

@532910, well ok i will reopen

@ImMALWARE ImMALWARE reopened this Jan 23, 2025
@532910
Copy link

532910 commented Jan 23, 2025

  1. old element and all other apps works perfect
  2. element x successfully downloads well-known file from my home-server

@ShadowRZ
Copy link
Contributor

@532910 @ImMALWARE The reason that Element X Android can download the well known is that it uses the Retrofit library to download this well known,

and here's the interesting thing:

That :0 proxy had an interesting behaviour, if set as the http proxy (for example, with adb shell settings put global http_proxy :0, I did this in an emulator), the system-wide ProxySelector will consider that we have no proxy, thus:

import java.net.ProxySelector
import java.net.URI

ProxySelector.getDefault().select(URI("http://example.com"))
# Returns a single entry [Proxy.NO_PROXY]

Retrofit uses OkHttp and by default inherits this system behaviour.

Rust isn't like that and will validate this proxy string, thus errored out.

I guess this should also applies to classic Element and other apps.

@simon-ging
Copy link

same problem, the home server works on other devices like linux and browser, and all other apps on the phone work fine, just the element x login doesn't work, neither in mobile internet, nor in wifi. pls consider fixing as the old app is not available anymore via google play.

@simon-ging
Copy link

my fix was to install the old app via f-droid.

@spaetz
Copy link

spaetz commented May 19, 2025

mmh, some VPN or other firewall app was setting Android's HTTP proxy settings to ":0" which rust apparently considers an invalid proxy. So from the app's point of view nothing to be fixed, as it is debatable whether ":0" is a valid HTTP proxy entry (aka don't use any) or an invalid one (preventing connections).

The proper fix is to remove the HTTP value which could also cause problems for other applications besides EXA

@ShadowRZ
Copy link
Contributor

The proper fix is to remove the HTTP value which could also cause
problems for other applications besides EXA

No I don't think that this value would trip most other apps, as this :0 proxy also won't cause any problems in Element Android, as it's using OkHttp via Retrofit. See for example #3447 (comment)
In some cases removing this value isn't possible as in #3447 (comment) and #3447 (comment)

So from the app's point of view nothing to be fixed, as it is debatable whether ":0" is a valid HTTP proxy entry (aka don't use any) or an invalid one (preventing connections).

I have written technical details in #3447 (comment) but to reiterate: The :0 proxy would make system believe we have no proxy defined, therefore: At least in Android system it means "don't use any".

@ShadowRZ ShadowRZ linked a pull request May 19, 2025 that will close this issue
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-Defect Something isn't working: bugs, crashes, hangs and other reported problems
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants