mirror of
https://github.com/matrix-org/matrix-spec
synced 2025-12-20 16:38:37 +01:00
Clarify Well-Known URIs (#2140)
Some checks failed
Spec / 🔎 Validate OpenAPI specifications (push) Has been cancelled
Spec / 🔎 Check Event schema examples (push) Has been cancelled
Spec / 🔎 Check OpenAPI definitions examples (push) Has been cancelled
Spec / 🔎 Check JSON Schemas inline examples (push) Has been cancelled
Spec / ⚙️ Calculate baseURL for later jobs (push) Has been cancelled
Spec / 📢 Run towncrier for changelog (push) Has been cancelled
Spell Check / Spell Check with Typos (push) Has been cancelled
Spec / 🐍 Build OpenAPI definitions (push) Has been cancelled
Spec / 📖 Build the spec (push) Has been cancelled
Spec / 🔎 Validate generated HTML (push) Has been cancelled
Spec / 📖 Build the historical backup spec (push) Has been cancelled
Some checks failed
Spec / 🔎 Validate OpenAPI specifications (push) Has been cancelled
Spec / 🔎 Check Event schema examples (push) Has been cancelled
Spec / 🔎 Check OpenAPI definitions examples (push) Has been cancelled
Spec / 🔎 Check JSON Schemas inline examples (push) Has been cancelled
Spec / ⚙️ Calculate baseURL for later jobs (push) Has been cancelled
Spec / 📢 Run towncrier for changelog (push) Has been cancelled
Spell Check / Spell Check with Typos (push) Has been cancelled
Spec / 🐍 Build OpenAPI definitions (push) Has been cancelled
Spec / 📖 Build the spec (push) Has been cancelled
Spec / 🔎 Validate generated HTML (push) Has been cancelled
Spec / 📖 Build the historical backup spec (push) Has been cancelled
* Clarify Well-Known URIs Signed-off-by: HarHarLinks <2803622+HarHarLinks@users.noreply.github.com> * Fix section link --------- Signed-off-by: HarHarLinks <2803622+HarHarLinks@users.noreply.github.com>
This commit is contained in:
parent
fe46e0c363
commit
ca9c376076
|
|
@ -0,0 +1 @@
|
||||||
|
Clarify that Well-Known URIs are available on the server name's hostname. Contributed by @HarHarLinks.
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
Clarify that Well-Known URIs are available on the server name's hostname. Contributed by @HarHarLinks.
|
||||||
|
|
@ -371,15 +371,23 @@ valid data was obtained, but no server is available to serve the client.
|
||||||
No further guess should be attempted and the user should make a
|
No further guess should be attempted and the user should make a
|
||||||
conscientious decision what to do next.
|
conscientious decision what to do next.
|
||||||
|
|
||||||
### Well-known URI
|
### Well-known URIs
|
||||||
|
|
||||||
|
Matrix facilitates automatic discovery for the Client-Server API base URL and more via the
|
||||||
|
[RFC 8615](https://datatracker.ietf.org/doc/html/rfc8615) "Well-Known URI" method.
|
||||||
|
This method uses JSON files at a predetermined location on the root path `/.well-known/` to
|
||||||
|
specify parameter values.
|
||||||
|
|
||||||
{{% boxes/note %}}
|
{{% boxes/note %}}
|
||||||
|
Diverging from the rest of the endpoints in the Client-Server spec, these files can not be provided
|
||||||
|
on the base URL that the Client-Server API is reachable on, as it is yet to be discovered.
|
||||||
|
Instead, they can be reached via HTTPS on the [server name](/appendices/#server-name)'s hostname as domain.
|
||||||
|
|
||||||
Servers hosting the `.well-known` JSON file SHOULD offer CORS headers,
|
Servers hosting the `.well-known` JSON file SHOULD offer CORS headers,
|
||||||
as per the [CORS](#web-browser-clients) section in this specification.
|
as per the [CORS](#web-browser-clients) section in this specification.
|
||||||
{{% /boxes/note %}}
|
{{% /boxes/note %}}
|
||||||
|
|
||||||
The `.well-known` method uses a JSON file at a predetermined location to
|
The flow for auto-discovery is as follows:
|
||||||
specify parameter values. The flow for this method is as follows:
|
|
||||||
|
|
||||||
1. Extract the [server name](/appendices/#server-name) from the user's Matrix ID by splitting the
|
1. Extract the [server name](/appendices/#server-name) from the user's Matrix ID by splitting the
|
||||||
Matrix ID at the first colon.
|
Matrix ID at the first colon.
|
||||||
|
|
@ -415,10 +423,17 @@ specify parameter values. The flow for this method is as follows:
|
||||||
|
|
||||||
{{% http-api spec="client-server" api="wellknown" %}}
|
{{% http-api spec="client-server" api="wellknown" %}}
|
||||||
|
|
||||||
{{% http-api spec="client-server" api="versions" %}}
|
|
||||||
|
|
||||||
{{% http-api spec="client-server" api="support" %}}
|
{{% http-api spec="client-server" api="support" %}}
|
||||||
|
|
||||||
|
### API Versions
|
||||||
|
|
||||||
|
Upon connecting, the Matrix client and server need to negotiate which version of the specification
|
||||||
|
they commonly support, as the API evolves over time. The server advertises its supported versions
|
||||||
|
and optionally unstable features to the client, which can then go on to make requests to the
|
||||||
|
endpoints it supports.
|
||||||
|
|
||||||
|
{{% http-api spec="client-server" api="versions" %}}
|
||||||
|
|
||||||
## Client Authentication
|
## Client Authentication
|
||||||
|
|
||||||
Most API endpoints require the user to identify themselves by presenting
|
Most API endpoints require the user to identify themselves by presenting
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,8 @@ to send. The process overall is as follows:
|
||||||
server must present a valid certificate for the hostname.
|
server must present a valid certificate for the hostname.
|
||||||
|
|
||||||
3. If the hostname is not an IP literal, a regular HTTPS request is
|
3. If the hostname is not an IP literal, a regular HTTPS request is
|
||||||
made to `https://<hostname>/.well-known/matrix/server`, expecting
|
made to `https://<hostname>/.well-known/matrix/server` (according to
|
||||||
|
[RFC 8615](https://datatracker.ietf.org/doc/html/rfc8615)), expecting
|
||||||
the schema defined later in this section. 30x redirects should be
|
the schema defined later in this section. 30x redirects should be
|
||||||
followed, however redirection loops should be avoided. Responses
|
followed, however redirection loops should be avoided. Responses
|
||||||
(successful or otherwise) to the `/.well-known` endpoint should be
|
(successful or otherwise) to the `/.well-known` endpoint should be
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,12 @@ paths:
|
||||||
description: |-
|
description: |-
|
||||||
Gets server admin contact and support page of the domain.
|
Gets server admin contact and support page of the domain.
|
||||||
|
|
||||||
Like the [well-known discovery URI](/client-server-api/#well-known-uri),
|
{{% boxes/note %}}
|
||||||
this should be accessed with the hostname of the homeserver by making a
|
Like the [well-known discovery URI](/client-server-api/#well-known-uris),
|
||||||
|
this endpoint should be accessed with the hostname of the homeserver's
|
||||||
|
[server name](/appendices/#server-name) by making a
|
||||||
GET request to `https://hostname/.well-known/matrix/support`.
|
GET request to `https://hostname/.well-known/matrix/support`.
|
||||||
|
{{% /boxes/note %}}
|
||||||
|
|
||||||
Note that this endpoint is not necessarily handled by the homeserver.
|
Note that this endpoint is not necessarily handled by the homeserver.
|
||||||
It may be served by another webserver, used for discovering support
|
It may be served by another webserver, used for discovering support
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,12 @@ paths:
|
||||||
suitably namespaced for each application and reduces the risk of
|
suitably namespaced for each application and reduces the risk of
|
||||||
clashes.
|
clashes.
|
||||||
|
|
||||||
|
{{% boxes/note %}}
|
||||||
|
This endpoint should be accessed with the hostname of the homeserver's
|
||||||
|
[server name](/appendices/#server-name) by making a
|
||||||
|
GET request to `https://hostname/.well-known/matrix/client`.
|
||||||
|
{{% /boxes/note %}}
|
||||||
|
|
||||||
Note that this endpoint is not necessarily handled by the homeserver,
|
Note that this endpoint is not necessarily handled by the homeserver,
|
||||||
but by another webserver, to be used for discovering the homeserver URL.
|
but by another webserver, to be used for discovering the homeserver URL.
|
||||||
operationId: getWellknown
|
operationId: getWellknown
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,12 @@ paths:
|
||||||
Gets information about the delegated server for server-server communication
|
Gets information about the delegated server for server-server communication
|
||||||
between Matrix homeservers. Servers should follow 30x redirects, carefully
|
between Matrix homeservers. Servers should follow 30x redirects, carefully
|
||||||
avoiding redirect loops, and use normal X.509 certificate validation.
|
avoiding redirect loops, and use normal X.509 certificate validation.
|
||||||
|
|
||||||
|
{{% boxes/note %}}
|
||||||
|
This endpoint should be accessed with the hostname of the homeserver's
|
||||||
|
[server name](/appendices/#server-name) by making a
|
||||||
|
GET request to `https://hostname/.well-known/matrix/server`.
|
||||||
|
{{% /boxes/note %}}
|
||||||
operationId: getWellKnown
|
operationId: getWellKnown
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue