Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Make it possible to customize /.well-known/matrix/client response #8739

Closed
henrikjohansson712 opened this issue Nov 10, 2020 · 5 comments · Fixed by #13035
Closed

Make it possible to customize /.well-known/matrix/client response #8739

henrikjohansson712 opened this issue Nov 10, 2020 · 5 comments · Fixed by #13035
Labels
P4 (OBSOLETE: use S- labels.) Okay backlog: will not schedule, will accept patches T-Enhancement New features, changes in functionality, improvements in performance, or user-facing enhancements. z-feature (Deprecated Label) Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution

Comments

@henrikjohansson712
Copy link

Description:

The response from the well-known endpoint is currently limited to the homeserver and identity server base urls. Chat clients like Element require that some settings are served through this endpoint, which is quite hard to do the way it's currently set up. Would it be possible to add a "well-known" section to homeserver.yaml where you can add custom values?

@erikjohnston erikjohnston added z-feature (Deprecated Label) Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution z-p3 (Deprecated Label) labels Nov 10, 2020
@erikjohnston
Copy link
Member

That seems reasonable.

@samiraguiar
Copy link

I have the same need and was thinking about working on it, but I'm unsure about the best approach.

We could specify the values returned by the /.well-known/matrix/client endpoint in a section in homeserver.yaml, or we could also specify the path to a JSON file containing such values. However, it would be interesting to avoid hardcoding and have scalable support for other endpoints, such as /.well-known/matrix/integrations and others.

What do you think?

@seth586
Copy link

seth586 commented Feb 19, 2021

Add the following excerpt inside your nginx reverse proxyserver{} block:

location /.well-known/matrix/client {
      return 200 '{"m.homeserver": {"base_url": "https://matrix.org"},"m.identity_server": {"base_url": "https://vector.im"}}';
      add_header Content-Type application/json;
      add_header "Access-Control-Allow-Origin" *;
    }

@rwjack
Copy link

rwjack commented Nov 9, 2021

I was trying to configure my homeserver to serve the same jitsi query for both element desktop and element web, since synapse serves it's own /.well-known/matrix/client, and the other /.well-known/matrix/client being my custom one served by nginx for federation purposes.

Nginx: https://domain.tld/.well-known/matrix/client
Homeserver: https://matrix.domain.tld/.well-known/matrix/client
Element web: https://chat.domain.tld/

When creating jitsi conferences from element-desktop, they would be redirected to app.element.io and use the jitsi.riot.im widget, opposed to my self hosted element-web, which respects the nginx version of /.well-known/matrix/client

I tried pointing matrix.domain.tld/.well-known/matrix/client to domain.tld/.well-known/matrix/client, and now even though both links serve the same content, element-desktop is still not respecting which jitsi server to use, nor the custom location of element-web.
I might be doing this wrong, but this bypass doesn't seem to do the job for me.

So for element-web to use my jitsi server, it was as easy as editing the config.json file:

"jitsi": {
    "preferredDomain": "jitsi.domain.tld"
}

And afterwards adding the following to nginx's .well-known.

"im.vector.riot.jitsi": {
     "preferredDomain": "jitsi.domain.tld"
}

And then when opening a conference in element-web, it goes to:
https://chat.domain.tld/foobar?jitsi.html#conferenceDomain=jitsi.domain.tld...

To fix this we just need a way of editing synapse's matrix.domain.tld/.well-known/matrix/client in homeserver.yml.

@DMRobertson DMRobertson added T-Enhancement New features, changes in functionality, improvements in performance, or user-facing enhancements. P4 (OBSOLETE: use S- labels.) Okay backlog: will not schedule, will accept patches and removed z-p3 (Deprecated Label) labels Nov 18, 2021
@manju-rn
Copy link

manju-rn commented Feb 25, 2022

I made this edit in the well_known.py well_known.py
Replace the existing line with the below. This would allow to link to your own jit.si servers for video conferences. This would be applicable to any client which is using this homeserver
result = {"m.homeserver": {"base_url": self._config.server.public_baseurl},"im.vector.riot.jitsi": {"preferredDomain": "my.jitsi.server"}}
my.jitsi.server: should point to your own jitsi meet server. Do remember to provide port number also, if not hosted on the 443

after making this entry, just rebuild the docker image. If feeling lazy to do that, then just edit this within the container and save as a separate image.

The above is still a hack, I will try to make a PR so that this entry for the im.vector.riot.jitsi can be picked up from the homeserver.yaml

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P4 (OBSOLETE: use S- labels.) Okay backlog: will not schedule, will accept patches T-Enhancement New features, changes in functionality, improvements in performance, or user-facing enhancements. z-feature (Deprecated Label) Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants