|
| 1 | +# Proposal to leverage SRV records to discover homeservers from clients |
| 2 | + |
| 3 | +Currently, the [specifications on server discovery by client](https://spec.matrix.org/unstable/client-server-api/#server-discovery) merely mentions the use of the `/.well-known/matrix/` HTTP path. |
| 4 | +This comes in contradiction with the [specifications on server discovery by servers](https://spec.matrix.org/unstable/server-server-api/#server-discovery) which also leverage the existence of a SRV record. |
| 5 | + |
| 6 | +Furthermore, this oddity makes the user front, arguably the most crucial part for technology |
| 7 | +adoption, the most complicated when a HTTP path is not used by the Matrix instance operator. |
| 8 | +For instance, in such a case, when an instance operator uses a `_matrix._tcp.example.org` SRV record |
| 9 | +pointing to an `example.com` instance on port `8448`, the `example.org` hostname shall be used |
| 10 | +in conjunction with the instance's (`example.com`) port for a client to find the homeserver. |
| 11 | + |
| 12 | +This oddity strengthens when you consider the technologies at hand: by design, the hierarchical and |
| 13 | +distributed design of DNS and the usual cache done by recursive (non-authoritative) resolvers, |
| 14 | +distributed amongst different operators, makes it so extra DNS requests usually have small to no impact |
| 15 | +on a target instance. On the other hand, HTTP endpoints scaling remaining in the hands of the end-of-line |
| 16 | +operators, extra HTTP request _do_ have an immediate impact on them. |
| 17 | + |
| 18 | +## Proposal |
| 19 | + |
| 20 | +The `SRV` record shall be used as specified in the server -> server API for client -> server discovery. |
| 21 | + |
| 22 | +## Tradeoffs |
| 23 | + |
| 24 | +If current server -> server API is kept, an extra DNS lookup will only be made in case the HTTP one fails. |
| 25 | +In case it is decided the `SRV` lookup shall be done first, the cost would still be minimal, |
| 26 | +DNS being designed to scale. |
0 commit comments