element-web: CORS Errors when trying to talk to homeserver on Element Desktop

Description

On Element Desktop, I cannot communicate with my homeserver https://talk.go7box.xyz. It consistently complains about connection errors. However, from the same machine, I can use Element Web, nheko, fractal, Wget and curl to login and communicate with the homeserver without any troubles. Element Desktop is the only client that is unable to talk to the homeserver.

Steps to reproduce

  • Start Element Desktop
  • Change Homeserver to “talk.go7box.xyz”
  • Try to Login

This should log the user in successfully. However, it throws an error instead: There was a problem communicating with the homeserver, please try again later.

I don’t have such an issue on my Element Android that is running on the same network. So I tried using nheko, fractal and Matrix Shell Suite. All of them could successfully login and send messages. Some on #element-web:matrix.org asked me to try with Element Web. So I ran Element Web on Firefox and even from there, I could log in successfully. Only on Element Desktop do I have this issue.

Next, in order to debug, I took a look at the network activity. The only difference I could see was that Element Web sends a: origin: app.element.io header whereas Element Desktop sends a origin: vector://vector header. On Element Desktop I also see a lot of errors in the console complaining that the CORS request had been rejected. I copied the failing POST request as cURL and ran it on the command line. That also succeeded without any issues. I received back a 200 response with a access_token in the JSON.

So, literally only Element Desktop is unable to communicate with the server. The exact same HTTP request when sent via Curl works just fine.

Logs being sent: Can’t

Version information

  • Homeserver: Synapse 1.38.1

  • Platform: Desktop

For the desktop app:

  • OS: Arch Linux
  • Version: 1.7.33

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 18 (12 by maintainers)

Most upvoted comments

I’m going to upgrade synapse tonight and try it again. I should get back to you within 24 hours with something.

On Tue, Aug 31, 2021, at 18:56, Šimon Brandner wrote:

@darnir https://github.com/darnir, can you still see this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/vector-im/element-web/issues/18248#issuecomment-909414018, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMVJNPMREPWNZ2Q53JSVMDT7UCT3ANCNFSM5BBBSZCA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

The issue seems to have disappeared entirely on its own. I haven’t changed anything, but I don’t see it anymore. So I’m going to close this issue. Thanks everyone that tried to help. If something shows up again, I’ll re-open here

Downgrading to O-Low as I believe this this rare and likely somehow setup specific, as we can’t reproduce.

If its a CORS issue … you should be able to open the network tab in the console (Ctrl+Shift+I) and look at the erroring requests to client and versions when you set the homeserver url and see in more detail why the request is failing