|
| 1 | +# MSC4156: Migrate `server_name` to `via` |
| 2 | + |
| 3 | +Room IDs in Matrix are generally not routable on their own. In the [room ID grammar] `!opaque_id:domain`, |
| 4 | +the `domain` is the server that created the room. There is, however, no guarantee that this server is |
| 5 | +still joined to the room at a later time. Therefore, room IDs don't provide a reliable resident server |
| 6 | +to send requests to. Critically, the `domain` is not to be used as a routing server. It is purely a namespace. |
| 7 | + |
| 8 | +The spec partially addresses this issue by defining a [`via`] query parameter on room URIs that can be |
| 9 | +used to list servers that have a high probability of being in the room in the distant future. Additionally, |
| 10 | +some APIs such as [`/_matrix/client/v3/join/{roomIdOrAlias}`] can take a `server_name` query parameter |
| 11 | +that has the same effect as `via`. |
| 12 | + |
| 13 | +The terminology difference between `server_name` and `via` can be slightly confusing which is why this |
| 14 | +proposal attempts to standardize on `via`. |
| 15 | + |
| 16 | + |
| 17 | +## Proposal |
| 18 | + |
| 19 | +The `server_name` query parameter on [`/_matrix/client/v3/join/{roomIdOrAlias}`] and |
| 20 | +[`/_matrix/client/v3/knock/{roomIdOrAlias}`] is deprecated and a new parameter `via: [string]` is |
| 21 | +introduced. |
| 22 | + |
| 23 | +Clients SHOULD use `via` when the homeserver they're talking to supports it. To do this, they MAY either |
| 24 | +detect server support through the supported spec versions in [`/_matrix/client/versions`] or always include |
| 25 | +both parameters (with identical values). |
| 26 | + |
| 27 | +Homeservers MUST ignore all `server_name` parameters if any `via` parameters are supplied. |
| 28 | + |
| 29 | + |
| 30 | +## Potential issues |
| 31 | + |
| 32 | +As with any migration, some effort will be required to update client and server implementations. Additionally, |
| 33 | +while the transitions isn't completed, the concurrent existence of both query parameters might lead to further |
| 34 | +confusion. |
| 35 | + |
| 36 | + |
| 37 | +## Alternatives |
| 38 | + |
| 39 | +None other than accepting status quo. |
| 40 | + |
| 41 | + |
| 42 | +## Security considerations |
| 43 | + |
| 44 | +A client that supplies different `via` and `server_name` parameters could be served a different room depending |
| 45 | +on which set of parameters the server uses to resolve the room ID. Tricking a client into doing this seems very |
| 46 | +difficult though because [Matrix URIs], for instance, only have a single documented `via` parameter. |
| 47 | + |
| 48 | + |
| 49 | +## Unstable prefix |
| 50 | + |
| 51 | +Until this proposal is accepted into the spec, implementations SHOULD refer to `via` as `org.matrix.msc4156.via`. |
| 52 | + |
| 53 | + |
| 54 | +## Dependencies |
| 55 | + |
| 56 | +None. |
| 57 | + |
| 58 | + |
| 59 | +[Matrix URIs]: https://spec.matrix.org/v1.11/appendices/#matrix-uri-scheme |
| 60 | +[room ID grammar]: https://spec.matrix.org/v1.10/appendices/#room-ids |
| 61 | +[`via`]: https://spec.matrix.org/v1.10/appendices/#routing |
| 62 | +[`/_matrix/client/v3/join/{roomIdOrAlias}`]: https://spec.matrix.org/v1.10/client-server-api/#post_matrixclientv3joinroomidoralias |
| 63 | +[`/_matrix/client/v3/knock/{roomIdOrAlias}`]: https://spec.matrix.org/v1.10/client-server-api/#post_matrixclientv3knockroomidoralias |
| 64 | +[`/_matrix/client/versions`]: https://spec.matrix.org/v1.10/client-server-api/#get_matrixclientversions |
0 commit comments