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 cannot connect to home server #2005

Closed
StephenJose-Dai opened this issue Nov 22, 2024 · 11 comments
Closed

element cannot connect to home server #2005

StephenJose-Dai opened this issue Nov 22, 2024 · 11 comments
Labels
O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect X-Needs-Info This issue is blocked awaiting information from the reporter

Comments

@StephenJose-Dai
Copy link

Steps to reproduce

I deployed synapse and made nginx proxy. I used nginx to reverse proxy synapse's http 8008, and nginx's external proxy is 9998. When I entered my server address in the windows application, let's say it is https://abc.com:9998, it told me that this does not look like a matrix server, but my mobile phone can connect to it normally. I am sure there is no problem with the URL. I tried to update the let's certificate to zerossl, unfortunately to no avail. I don't know how to solve this problem. I hope to get help, please!

image

If I use http directly it can connect normally, because it does not go through nginx, but directly connects to synapse's port 8008. I don't believe it is my nginx problem, this is my nginx configuration.

image

It is worth noting that my domain name only resolves IPV6, and I believe element supports ipv6 access

Outcome

I deployed synapse and made nginx proxy. I used nginx to reverse proxy synapse's http 8008, and nginx's external proxy is 9998. When I entered my server address in the windows application, let's say it is https://abc.com:9998, it told me that this does not look like a matrix server, but my mobile phone can connect to it normally. I am sure there is no problem with the URL. I tried to update the let's certificate to zerossl, unfortunately to no avail. I don't know how to solve this problem. I hope to get help, please!

image

If I use http directly it can connect normally, because it does not go through nginx, but directly connects to synapse's port 8008. I don't believe it is my nginx problem, this is my nginx configuration.

image

It is worth noting that my domain name only resolves IPV6, and I believe element supports ipv6 access!

Operating system

Windows

Application version

1.11.86.0

How did you install the app?

https://element.io/download

Homeserver

synapse

Will you send logs?

Yes

@dosubot dosubot bot added O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Major Severely degrades major functionality or product features, with no satisfactory workaround labels Nov 22, 2024
@t3chguy
Copy link
Member

t3chguy commented Nov 22, 2024

Will you send logs?
Yes

Not seeing any logs from you, those would say which request fails and why you cannot connect

@t3chguy t3chguy added the X-Needs-Info This issue is blocked awaiting information from the reporter label Nov 22, 2024
@StephenJose-Dai
Copy link
Author

Will you send logs?
Yes

Not seeing any logs from you, those would say which request fails and why you cannot connect

I'm not sure what kind of log you need, nginx or Element log?

@StephenJose-Dai
Copy link
Author

Will you send logs?
Yes

Not seeing any logs from you, those would say which request fails and why you cannot connect

I'm not sure what kind of log you need, nginx or Element log?

This is my nginx access log, it looks normal

image

I don't see any entries in my nginx error log, which I think is a good sign.

image

This is the log of my synapse container. I don't see any problem.

@t3chguy
Copy link
Member

t3chguy commented Nov 23, 2024

Element logs are the only helpful ones here. Ctrl shift I to open the console.

@StephenJose-Dai
Copy link
Author

Element logs are the only helpful ones here. Ctrl shift I to open the console.

I think this is what you want

image

image

@t3chguy
Copy link
Member

t3chguy commented Nov 23, 2024

I suggest reading through your 2nd screenshot, looks like your CORS/ACAO is invalid

@StephenJose-Dai
Copy link
Author

I suggest reading through your 2nd screenshot, looks like your CORS/ACAO is invalid

I believe you have seen my nginx configuration. It seems that there is no configuration for this. The nginx configuration given in the official documentation is like this.
So according to the error, should I configure the corresponding cross-domain parameters in nginx?

@t3chguy
Copy link
Member

t3chguy commented Nov 23, 2024

The header may be being sent by your nginx, any other reverse proxy before it, your Synapse, anything, one thing it isn't being sent by is your Element.

image

Seems like the header value got doubled up which makes it invalid.

@StephenJose-Dai
Copy link
Author

The header may be being sent by your nginx, any other reverse proxy before it, your Synapse, anything, one thing it isn't being sent by is your Element.

I solved this problem. It seems that synapse will automatically add this

"add_header Access-Control-Allow-Origin "*" always;"

But I didn't know, so I added this sentence to nginx and caused a conflict. I just need to comment out

"add_header Access-Control-Allow-Origin "*" always;"

in nginx.

@t3chguy
Copy link
Member

t3chguy commented Nov 23, 2024

Its in the Matrix Spec https://spec.matrix.org/v1.12/client-server-api/#web-browser-clients so its fairly implied that a Matrix Server would send it. Did that fix the issue for you now then?

@StephenJose-Dai
Copy link
Author

Its in the Matrix Spec https://spec.matrix.org/v1.12/client-server-api/#web-browser-clients so its fairly implied that a Matrix Server would send it. Did that fix the issue for you now then?

My problem has been solved, and I thank you very much for your suggestions and help.

@t3chguy t3chguy closed this as completed Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect X-Needs-Info This issue is blocked awaiting information from the reporter
Projects
None yet
Development

No branches or pull requests

2 participants