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

Add SYNCV3_SERVER_PUB environment variable pointing to the public homeserver URL #386

Conversation

spantaleev
Copy link

SYNCV3_SERVER continues to be used for connecting to the server.

SYNCV3_SERVER_PUB is a new environment variable (defaulting to the value of SYNCV3_SERVER), so that people who are already pointing SYNCV3_SERVER to a public URL do not need to set both.

This change affects the server field in the generated /client/server.json file, so that this field points to the public homeserver URL (SYNCV3_SERVER_PUB).

Related to spantaleev/matrix-docker-ansible-deploy#2583

Pull Request Checklist

…eserver URL

`SYNCV3_SERVER` continues to be used for connecting to the server.

`SYNCV3_SERVER_PUB` is a new environment variable (defaulting to the
value of `SYNCV3_SERVER`), so that people who are already pointing
`SYNCV3_SERVER` to a public URL do not need to set both.

This change affects the `server` field in the generated `/client/server.json`
file, so that this field points to the public homeserver URL (`SYNCV3_SERVER_PUB`).

Related to spantaleev/matrix-docker-ansible-deploy#2583

Signed-off-by: Slavi Pantaleev <[email protected]>
@spantaleev
Copy link
Author

spantaleev commented Dec 13, 2023

I'm not sure if this is the right place to fix this.

This is to benefit Element-web, which seems to be hitting /client/server.json and complaining that the internal homeserver URL there does not match the homeserver it's talking to, as desribed in spantaleev/matrix-docker-ansible-deploy#2583

Element X (at least on iOS) does not seem to be doing such checks and does not care what /client/server.json says.

So it may be that element-web needs to stop caring too, or that Element X needs to be fixed. In any case, it seems like /client/server.json may also benefit from advertising the correct public homeserver URL anyway.


Working on this, I've also noticed that #378 (ae73ace) which introduced UNIX socket support (to SYNCV3_SERVER and SYNCV3_BINDADDR) may also benefit from this current patch landing.

When SYNCV3_SERVER is pointed to a UNIX socket, it also ends up in the /client/server.json file ("server": "/socket.sock", ..} which I suppose clients like Element will not like. People using UNIX sockets can use the new SYNCV3_SERVER_PUB environment variable for the public homeserver URL.

I also believe that validation checks in cmd/syncv3/main.go should be adjusted, so that when SYNCV3_SERVER is pointed to a socket file, SYNCV3_SERVER_PUB would be required.

If you agree with this, I could prepare another PR.. Or feel free to quickly fix it up yourselves.

@kegsay
Copy link
Member

kegsay commented Jan 2, 2024

So it may be that element-web needs to stop caring too

This. /client/server.json isn't part of the MSC, and element-web shouldn't care about this nowadays. The SYNCV3_SERVER env var is an internal URL, and really we probably shouldn't be leaking it outside (via /client/server.json). Adding another env var just confuses things more.

@spantaleev
Copy link
Author

Sounds good!

I wonder why element-web is trying to read it from there though. Perhaps that should be fixed first.

@kegsay
Copy link
Member

kegsay commented Jan 12, 2024

Nothing to do here, so closing. Element-Web should not be checking /client/server.json anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants