No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. # Delegation of incoming federation traffic
  2. In the following documentation, we use the term `server_name` to refer to that setting
  3. in your homeserver configuration file. It appears at the ends of user ids, and tells
  4. other homeservers where they can find your server.
  5. By default, other homeservers will expect to be able to reach yours via
  6. your `server_name`, on port 8448. For example, if you set your `server_name`
  7. to `example.com` (so that your user names look like `@user:example.com`),
  8. other servers will try to connect to yours at `https://example.com:8448/`.
  9. Delegation is a Matrix feature allowing a homeserver admin to retain a
  10. `server_name` of `example.com` so that user IDs, room aliases, etc continue
  11. to look like `*:example.com`, whilst having federation traffic routed
  12. to a different server and/or port (e.g. `synapse.example.com:443`).
  13. ## .well-known delegation
  14. To use this method, you need to be able to configure the server at
  15. `https://<server_name>` to serve a file at
  16. `https://<server_name>/.well-known/matrix/server`. There are two ways to do this, shown below.
  17. Note that the `.well-known` file is hosted on the default port for `https` (port 443).
  18. ### External server
  19. For maximum flexibility, you need to configure an external server such as nginx, Apache
  20. or HAProxy to serve the `https://<server_name>/.well-known/matrix/server` file. Setting
  21. up such a server is out of the scope of this documentation, but note that it is often
  22. possible to configure your [reverse proxy](reverse_proxy.md) for this.
  23. The URL `https://<server_name>/.well-known/matrix/server` should be configured
  24. return a JSON structure containing the key `m.server` like this:
  25. ```json
  26. {
  27. "m.server": "<synapse.server.name>[:<yourport>]"
  28. }
  29. ```
  30. In our example (where we want federation traffic to be routed to
  31. `https://synapse.example.com`, on port 443), this would mean that
  32. `https://example.com/.well-known/matrix/server` should return:
  33. ```json
  34. {
  35. "m.server": "synapse.example.com:443"
  36. }
  37. ```
  38. Note, specifying a port is optional. If no port is specified, then it defaults
  39. to 8448.
  40. ### Serving a `.well-known/matrix/server` file with Synapse
  41. If you are able to set up your domain so that `https://<server_name>` is routed to
  42. Synapse (i.e., the only change needed is to direct federation traffic to port 443
  43. instead of port 8448), then it is possible to configure Synapse to serve a suitable
  44. `.well-known/matrix/server` file. To do so, add the following to your `homeserver.yaml`
  45. file:
  46. ```yaml
  47. serve_server_wellknown: true
  48. ```
  49. **Note**: this *only* works if `https://<server_name>` is routed to Synapse, so is
  50. generally not suitable if Synapse is hosted at a subdomain such as
  51. `https://synapse.example.com`.
  52. ## SRV DNS record delegation
  53. It is also possible to do delegation using a SRV DNS record. However, that is generally
  54. not recommended, as it can be difficult to configure the TLS certificates correctly in
  55. this case, and it offers little advantage over `.well-known` delegation.
  56. Please keep in mind that server delegation is a function of server-server communication,
  57. and as such using SRV DNS records will not cover use cases involving client-server comms.
  58. This means setting global client settings (such as a Jitsi endpoint, or disabling
  59. creating new rooms as encrypted by default, etc) will still require that you serve a file
  60. from the `https://<server_name>/.well-known/` endpoints defined in the spec! If you are
  61. considering using SRV DNS delegation to avoid serving files from this endpoint, consider
  62. the impact that you will not be able to change those client-based default values globally,
  63. and will be relegated to the featureset of the configuration of each individual client.
  64. However, if you really need it, you can find some documentation on what such a
  65. record should look like and how Synapse will use it in [the Matrix
  66. specification](https://matrix.org/docs/spec/server_server/latest#resolving-server-names).
  67. ## Delegation FAQ
  68. ### When do I need delegation?
  69. If your homeserver's APIs are accessible on the default federation port (8448)
  70. and the domain your `server_name` points to, you do not need any delegation.
  71. For instance, if you registered `example.com` and pointed its DNS A record at a
  72. fresh server, you could install Synapse on that host, giving it a `server_name`
  73. of `example.com`, and once a reverse proxy has been set up to proxy all requests
  74. sent to the port `8448` and serve TLS certificates for `example.com`, you
  75. wouldn't need any delegation set up.
  76. **However**, if your homeserver's APIs aren't accessible on port 8448 and on the
  77. domain `server_name` points to, you will need to let other servers know how to
  78. find it using delegation.
  79. ### Should I use a reverse proxy for federation traffic?
  80. Generally, using a reverse proxy for both the federation and client traffic is a good
  81. idea, since it saves handling TLS traffic in Synapse. See
  82. [the reverse proxy documentation](reverse_proxy.md) for information on setting up a
  83. reverse proxy.