Skip to content
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

Element-Desktop 1.9.7 Windows/Linux login on homeserver not possible #20227

Closed
pprugger opened this issue Dec 16, 2021 · 18 comments
Closed

Element-Desktop 1.9.7 Windows/Linux login on homeserver not possible #20227

pprugger opened this issue Dec 16, 2021 · 18 comments
Labels
T-Defect X-Needs-Info This issue is blocked awaiting information from the reporter

Comments

@pprugger
Copy link

Steps to reproduce

Download and install Element-Desktop 1.9.7 for Windows
Start Element-Desktop
Click on edit to change the homeserver
Type in your homeserver: https://homeserver-url
Element-Desktop keeps to persist to say it is not e valid homeserver.

Element works on the Webclient, Linux, Android and IOS with this homeserver.
Only the Windows version fails to function.

In my debbuging i found that:
If you just type in the homeserver url the client tries to query .well-known/matrix/client
With the https:// prepended the client does not even query the homeserver
Just says: "Homeserver URL does not seem to be a valid Matrix Homeserver".

Outcome

What did you expect?

Login to my own homeserver

What happened instead?

Just says: "Homeserver URL does not seem to be a valid Matrix Homeserver".

Operating system

Windows 10

Application version

Element-Desktop 1.9.7

How did you install the app?

https://element.io/get-started#download

Homeserver

https://prometheus.umask.eu

Will you send logs?

No

@kittykat
Copy link
Contributor

@pprugger can you please check if there are any errors in the console (you should be able to open it with Ctrl+i, then go to the Console tab)

@pprugger
Copy link
Author

image

Here a screenshot of the errors!

@pprugger
Copy link
Author

pprugger commented Dec 17, 2021

Additional info:
After many more tests i can confirm, this also occurs on the linux client.
I retestet the 1.9.6 client and this one works.
So it seems this has been introduced in 1.9.7.

Additionally the CORS error in 1.9.7 prevents the client completely from syncing.

@t3chguy
Copy link
Member

t3chguy commented Dec 17, 2021

CORS is entirely outside the hands of Element, it is a handshake between the browser (Chromium) and your Web Server.

If you check the Network tab and try again it'll give you more details about the error.

@pprugger
Copy link
Author

pprugger commented Dec 17, 2021

Hey @t3chguy !
I am talking about Element-Desktop here.
I just wrote what i observed.
The 1.9.6 desktop client just works.
No CORS errors, login works, sync works.

1.9.7 is broken.
It just keeps syncing forever.

Same server of course.

@pprugger pprugger changed the title Element-Desktop 1.9.7 for Windows Login on homeserver not possible Element-Desktop 1.9.7 Windows/Linux login on homeserver not possible Dec 17, 2021
@t3chguy
Copy link
Member

t3chguy commented Dec 17, 2021

Element Desktop uses Electron which is built on Chromium, hence me saying that.
Again, check the network tab for more details.

@t3chguy t3chguy added the X-Needs-Info This issue is blocked awaiting information from the reporter label Dec 17, 2021
@pprugger
Copy link
Author

pprugger commented Dec 17, 2021

I dont know what that should tell me more than the errors i already have posted.
It shows the same CORS error.
When i set add_header Access-Control-Allow-Origin *;
the client just says that only one origin is allowed.

Also i still have the error, that the server is not a valid homeserver. no idea why.

@t3chguy
Copy link
Member

t3chguy commented Dec 17, 2021

If you click on the request it'll show you response headers, which you can use to figure out why it was flagged as CORS, e.g missing ACAO header.

@pprugger
Copy link
Author

pprugger commented Dec 17, 2021

As i already stated, i tried setting and changing the ACAO header with no luck.
This though doesn't explain the server_name error.
I guess this are two different things that both came with 1.9.7.

Error processing homeserver config: {state: "FAIL_ERROR", error: "Homeserver URL does not appear to be a valid Matrix homeserver", base_url: "https://prometheus.umask.eu"}

Attempted prometheus.umask.eu as a server_name but it failed Error: Homeserver URL does not appear to be a valid Matrix homeserver
at g (languageHandler.tsx:56)
at Function.buildValidatedConfigFromDiscovery (AutoDiscoveryUtils.tsx:242)
at deriveData (ServerPickerDialog.tsx:95)
at async r.validate (Validation.tsx:95)
at async _.validate (Field.tsx:200)

@t3chguy
Copy link
Member

t3chguy commented Dec 20, 2021

Again, only the info in the Network tab would be helpful as the Javascript Console only contains app logs but with CORS the browser obscures the underlying cause for security reasons.

@pprugger
Copy link
Author

pprugger commented Dec 21, 2021

This is what Element does:

Sometimes some querky queries
image

image

image

Compared to directly in chrome:
image

@Melchiorro
Copy link

Hello! Exactly the same error on 1.10.* with my homeserver

Linux, android, macos and most windows clients works as before without any problems. Some windows desktop clients lost connection with the server after updating to version 1.10.0. After logging out of the account, it is impossible to log back in - the address of the home server is not accepted. The console shows the following errors
Безымянный
Безымянный2
Безымянный3

At the same time, in the web version, the same devices connect to the server successfully. There are no errors when running desktop 1.9 too. Update to 1.10.1 not didn't help.

OS: Windows 10.

How else can i help you find the problem?

@Melchiorro
Copy link

Okay, we were able to solve this problem. On computers where this problem arose, an alternative dns from Google was registered. For some reason, version 1.10 lost the server until you removed dns from the connection options, but at the same time, 1.9 worked flawlessly on the same device and with dns too.

@Torxed
Copy link

Torxed commented May 26, 2022

CORS is entirely outside the hands of Element, it is a handshake between the browser (Chromium) and your Web Server.

I don't fully agree with this. As the Origin header is all sorts of special when it comes to element/synapse.
For anyone ending up here.. and running nginx as a reverse proxy:

server {
    location / {
        if ($http_origin = 'https://your.frontend.lan') {
                add_header Access-Control-Allow-Origin "https://your.frontend.lan";
        }
        if ($http_origin = 'https://your.backend.lan') {
                add_header Access-Control-Allow-Origin "https://your.backend.lan";
        }
        if ($http_origin = 'vector://vector') {
                add_header Access-Control-Allow-Origin "vector://vector";
        }
    }
}

I don't like adding vector://vector here, but these are the things that have to go in there to avoid the issues above.

@t3chguy
Copy link
Member

t3chguy commented May 26, 2022

@Torxed the Matrix spec recommends * https://spec.matrix.org/v1.2/client-server-api/#web-browser-clients - given Matrix is an open protocol and other web clients exist, e.g Hydrogen

@Torxed
Copy link

Torxed commented May 26, 2022

@Torxed the Matrix spec recommends * https://spec.matrix.org/v1.2/client-server-api/#web-browser-clients - given Matrix is an open protocol and other web clients exist, e.g Hydrogen

Correct me if I'm wrong, but that would allow any site to access content on a client running under another domain? Meaning the whole safety that restriction puts in place gets null and void? (Assuming that the browsers honor it in the first place, which all the major ones does)

@t3chguy
Copy link
Member

t3chguy commented May 26, 2022

but that would allow any site to access content on a client running under another domain?

No, it merely tells what origins a web browser should allow to make web requests to your API service. It does not control cross-tab or cross-origin access of any data or client state, merely the HTTP request passing or failing.

@turt2live
Copy link
Member

From the history it appears as though all cases are configuration errors and not something we can fix ourselves. If you see this, please visit #element-web:matrix.org on Matrix for troubleshooting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-Defect X-Needs-Info This issue is blocked awaiting information from the reporter
Projects
None yet
Development

No branches or pull requests

6 participants