@ -109,14 +109,14 @@ The process overall is as follows:
1. If the hostname is an IP literal, then that IP address should be used,
1. If the hostname is an IP literal, then that IP address should be used,
together with the given port number, or 8448 if no port is given. The
together with the given port number, or 8448 if no port is given. The
target server must present a valid certificate for the IP address.
target server must present a valid certificate for the IP address.
Requests must be made with a `` Host `` header containing the IP address ,
The `` Host `` header in the request should be set to the server name ,
without port .
including the port if the server name included one .
2. If the hostname is not an IP literal, and the server name includes an explicit port,
2. If the hostname is not an IP literal, and the server name includes an
resolve the IP address using AAAA or A records. Requests are made to
explicit port, resolve the IP address using AAAA or A records. Requests
the resolved IP address and given port with a `` Host `` header of the
are made to the resolved IP address and given port with a `` Host `` header
original host name (with port). The target server must present a valid
of the original server name (with port). The target server must present a
certificate for the hostname.
valid certificate for the hostname.
3. If the hostname is not an IP literal, a regular HTTPS request is made
3. If the hostname is not an IP literal, a regular HTTPS request is made
to `` https://<hostname>/.well-known/matrix/server `` , expecting the
to `` https://<hostname>/.well-known/matrix/server `` , expecting the
@ -130,39 +130,38 @@ The process overall is as follows:
recommended. Errors are recommended to be cached for up to an hour,
recommended. Errors are recommended to be cached for up to an hour,
and servers are encouraged to exponentially back off for repeated
and servers are encouraged to exponentially back off for repeated
failures. The schema of the `` /.well-known `` request is later in this
failures. The schema of the `` /.well-known `` request is later in this
section. If the response is invalid (bad JSON, missing properties, etc),
section. If the response is invalid (bad JSON, missing properties, non-200
attempts to connect to the target server are aborted - no connections
response, etc), skip to step 4. If the response is valid, the `` m.server ``
should be attempted. If the response is valid, the `` m.server `` property
property is parsed as `` <delegated_hostname>[:<delegated_port>] `` and
is parsed as `` <delegated_server_name>[:<delegated_port>] `` and processed
processed as follows:
as follows:
* If `` <delegated_ server_ name>`` is an IP literal, then that IP address
* If `` <delegated_ host name>`` is an IP literal, then that IP address
should be used together with the `` <delegated_port> `` or 8448 if no
should be used together with the `` <delegated_port> `` or 8448 if no
port is provided. The target server must present a valid TLS certificate
port is provided. The target server must present a valid TLS certificate
for the IP address. Requests must be made with a `` Host `` header containing
for the IP address. Requests must be made with a `` Host `` header containing
the IP address, w ith port.
the IP address, including the port if one was provided .
* If `` <delegated_ server_ name>`` is not an IP literal, and `` <delegated_port> ``
* If `` <delegated_ host name>`` is not an IP literal, and `` <delegated_port> ``
is present, an IP address is disovered by looking up an AAAA or A
is present, an IP address is disovered by looking up an AAAA or A
record for `` <delegated_ server_ name>`` . The resulting IP address is
record for `` <delegated_ host name>`` . The resulting IP address is
used, alongside the `` <delegated_port> `` , to make requests with a
used, alongside the `` <delegated_port> `` . Requests must be made with a
`` Host `` header of `` <delegated_ server_ name>:<delegated_port>`` . The
`` Host `` header of `` <delegated_ host name>:<delegated_port>`` . The
target server must present a valid certificate for `` <delegated_ server_ name>`` .
target server must present a valid certificate for `` <delegated_ host name>`` .
* If `` <delegated_ server_ name>`` is not an IP literal and no
* If `` <delegated_ host name>`` is not an IP literal and no
`` <delegated_port> `` is present, an SRV record is looked up for
`` <delegated_port> `` is present, an SRV record is looked up for
`` _matrix._tcp.<delegated_ server_ name>`` . This may result in another
`` _matrix._tcp.<delegated_ host name>`` . This may result in another
hostname (to be resolved using AAAA or A records) and port. Requests
hostname (to be resolved using AAAA or A records) and port. Requests
should be made to the resolved IP address and port with a `` Host ``
should be made to the resolved IP address and port with a `` Host ``
header containing the `` <delegated_ server_ name>`` . The target server
header containing the `` <delegated_ host name>`` . The target server
must present a valid certificate for `` <delegated_ server_ name>`` .
must present a valid certificate for `` <delegated_ host name>`` .
* If no SRV record is found, an IP address is resolved using AAAA
* If no SRV record is found, an IP address is resolved using AAAA
or A records. Requests are then made to the resolve IP address
or A records. Requests are then made to the resolve IP address
and a port of 8448, using a `` Host `` header of `` <delegated_ server_ name>`` .
and a port of 8448, using a `` Host `` header of `` <delegated_ host name>`` .
The target server must present a valid certificate for `` <delegated_ server_ name>`` .
The target server must present a valid certificate for `` <delegated_ host name>`` .
4. If the `/.well-known` request did not result in a 200 response, a server
4. If the `/.well-known` request resulted in an error response, a server
is found by resolving an SRV record for `` _matrix._tcp.<hostname> `` . This
is found by resolving an SRV record for `` _matrix._tcp.<hostname> `` . This
may result in a hostname (to be resolved using AAAA or A records) and
may result in a hostname (to be resolved using AAAA or A records) and
port. Requests are made to the resolved IP address and port, using 8448
port. Requests are made to the resolved IP address and port, using 8448