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

.well-known request comes with a double slash - federation delegation not working as expected #3827

Open
apfelnutzer opened this issue Feb 25, 2025 · 5 comments
Labels
T-Defect X-Needs-Info This issue is blocked awaiting information from the reporter

Comments

@apfelnutzer
Copy link

Steps to reproduce

  1. Where are you starting? What can you see?
    I discovered failed Element requests in my Traefik logs showing that the .well-known request of Element X for iOS starts with a double "/":

[25/Feb/2025:14:46:22 +0000] "GET //.well-known/element/element.json HTTP/1.1" 404 1236 "-" "Element X/25.02.0

Moreover Element X ignored federation delegation on my server which I fixed within Traefik. Synapse is hosted on matrix.server.tld, but requests where send to server.tld despite delegation, so I forwarded everything starting with server.tld/_matrix to matrix.server.tld/_matrix ...

Outcome

What did you expect?

Request should just contain one /, .well-known files is loaded/considered respectively and further request are considering delegation.

What happened instead?

Request contains two slashed, .well-known files are ignored.

Your phone model

iPhone 13

Operating system version

iOS 18.3.1

Application version

25.02.0

Homeserver

1.124.0

Will you send logs?

No

@pixlwave
Copy link
Member

pixlwave commented Feb 26, 2025

Hi, thanks for reporting this. The double slash sounds like a bug, however .well-known look-up isn't meant to respect delegation, it is computed from your user ID.

This spec provides more detail about how this works: https://spec.matrix.org/v1.13/client-server-api/#well-known-uri

@apfelnutzer
Copy link
Author

Thanks for looking into this! What I meant is, that subsequent request are not considering the federation delegation. I fixed this (until further notice) by forwarding all server.tld/_matrix traffic respectively.

@pixlwave
Copy link
Member

The subsequent requests are not meant to do anything different to the first requests. The .well-known is always meant to be found from the last part of your user ID, no matter where the server lives.

Also, fwiw clients have nothing to do with federation - only .well-known/matrix/server is for servers (and federation).

@apfelnutzer
Copy link
Author

I made sure, that the .well-known file can by found under server.tld (by Traefik, hosted by nginx). This holds for a server and client file. The client file says:

{
  "m.homeserver": {
    "base_url": "https://matrix.server.tld"
  }
}

Isn't that meant for delegation (user names are @user:server.tld)?

@pixlwave
Copy link
Member

Ohhhh wait sorry. So it's doing server.tld//.well-known/element/element.json which is fine (apart from the double slash) and will continue to do this for well-knowns. But then you're saying it's also doing e.g. server.tld/_matrix/client/v3/login instead of matrix.server.tld/_matrix/client/v3/login?

@Velin92 Velin92 added the X-Needs-Info This issue is blocked awaiting information from the reporter label Mar 3, 2025
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

3 participants