From 5e2a2f80494bdbe4412d1ccc68b51442081696cf Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Thu, 13 Aug 2026 06:15:32 +0300 Subject: [PATCH] Redirect the homeserver root path to any enabled web client, not just Element Web MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Visiting the homeserver's root path used to redirect to Element Web, but only when Element Web was the client the playbook installed. People running Cinny, Commet, FluffyChat, Hydrogen, SchildiChat or Sable landed on a bare homeserver page instead. The wiring now builds matrix_playbook_public_client_urls — the public URLs of every playbook-managed web client which is enabled, ordered by preference — and redirects to the first of them. Element Web stays first, so existing setups redirect exactly where they did before. The URL is computed once and shared by all five homeserver implementations, which each carried their own copy of the old Element-Web-only expression. It honours each client's own scheme, hostname and path prefix, so a client served under a subpath now gets linked correctly. Supersedes https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/5513 Co-Authored-By: Claude Opus 5 --- CHANGELOG.md | 8 ++++++++ group_vars/matrix_servers | 35 ++++++++++++++++++++++++++++++----- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2e3615e6..74e4a1dd1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # 2026-08-13 +## The homeserver root path redirects to clients other than Element Web + +Visiting `https://matrix.example.com/` used to redirect you to [Element Web](docs/configuring-playbook-client-element-web.md), but only if Element Web was the client installed by the playbook. With any of the other web clients (Cinny, Commet, FluffyChat, Hydrogen, SchildiChat, Sable), you would land on a bare Synapse page. + +The redirection now follows whichever of these clients you have enabled. When several are enabled, Element Web wins, followed by the others in the order that [`group_vars/matrix_servers`](group_vars/matrix_servers) lists them. + +To send people somewhere else (or nowhere at all), define `matrix_playbook_public_client_root_redirection_url` in your `vars.yml` file. An empty value disables the redirection. + ## Support for Meowlnir The playbook can now install [Meowlnir](https://github.com/maunium/meowlnir), an opinionated Matrix moderation bot, optimized for Synapse. diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index dff99dca2..06143f6b4 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -60,6 +60,31 @@ matrix_playbook_public_matrix_federation_api_traefik_entrypoint_config_http3_ena # and affects how services configure their public URLs. matrix_federation_traefik_entrypoint_tls: "{{ traefik_config_entrypoint_web_secure_enabled }}" +# The public URLs of all playbook-managed Matrix client (web) applications which are enabled, +# ordered by preference (that is: the same order that these clients are wired up in this file). +matrix_playbook_public_client_urls: | + {{ + ([matrix_client_element_scheme + '://' + matrix_client_element_hostname + matrix_client_element_path_prefix] if matrix_client_element_enabled else []) + + + ([matrix_client_commet_scheme + '://' + matrix_client_commet_hostname + matrix_client_commet_path_prefix] if matrix_client_commet_enabled else []) + + + ([hydrogen_scheme + '://' + hydrogen_hostname + hydrogen_path_prefix] if hydrogen_enabled else []) + + + ([cinny_scheme + '://' + cinny_hostname + cinny_path_prefix] if cinny_enabled else []) + + + ([sable_scheme + '://' + sable_hostname + sable_path_prefix] if sable_enabled else []) + + + ([matrix_client_schildichat_scheme + '://' + matrix_client_schildichat_hostname + matrix_client_schildichat_path_prefix] if matrix_client_schildichat_enabled else []) + + + ([matrix_client_fluffychat_scheme + '://' + matrix_client_fluffychat_hostname + matrix_client_fluffychat_path_prefix] if matrix_client_fluffychat_enabled else []) + }} + +# The URL that requests hitting the homeserver's root path (`/`) are redirected to. +# +# It points to the most-preferred playbook-managed client (see `matrix_playbook_public_client_urls`), +# or is empty (no redirection) if no such client is enabled. +matrix_playbook_public_client_root_redirection_url: "{{ matrix_playbook_public_client_urls | first | default('', true) }}" + ######################################################################## # # # /Playbook # @@ -5028,7 +5053,7 @@ matrix_synapse_container_labels_traefik_compression_middleware_name: "{{ matrix_ matrix_synapse_container_labels_matrix_labels_enabled: "{{ not matrix_synapse_workers_enabled }}" matrix_synapse_container_labels_public_client_root_redirection_enabled: "{{ matrix_synapse_container_labels_public_client_root_redirection_url != '' }}" -matrix_synapse_container_labels_public_client_root_redirection_url: "{{ (('https://' if matrix_playbook_ssl_enabled else 'http://') + matrix_server_fqn_element) if matrix_client_element_enabled else '' }}" +matrix_synapse_container_labels_public_client_root_redirection_url: "{{ matrix_playbook_public_client_root_redirection_url }}" matrix_synapse_container_labels_public_client_synapse_admin_api_enabled: "{{ matrix_ketesa_enabled or matrix_element_admin_enabled }}" matrix_synapse_container_labels_internal_client_synapse_admin_api_enabled: "{{ (matrix_bot_draupnir_enabled and matrix_bot_draupnir_admin_api_enabled) }}" @@ -5855,7 +5880,7 @@ matrix_dendrite_container_labels_traefik_tls_certResolver: "{{ traefik_certResol matrix_dendrite_container_labels_public_client_synapse_admin_api_enabled: "{{ matrix_ketesa_enabled }}" matrix_dendrite_container_labels_public_client_root_redirection_enabled: "{{ matrix_dendrite_container_labels_public_client_root_redirection_url != '' }}" -matrix_dendrite_container_labels_public_client_root_redirection_url: "{{ (('https://' if matrix_playbook_ssl_enabled else 'http://') + matrix_server_fqn_element) if matrix_client_element_enabled else '' }}" +matrix_dendrite_container_labels_public_client_root_redirection_url: "{{ matrix_playbook_public_client_root_redirection_url }}" matrix_dendrite_container_labels_public_federation_api_traefik_hostname: "{{ matrix_server_fqn_matrix_federation }}" matrix_dendrite_container_labels_public_federation_api_traefik_entrypoints: "{{ matrix_federation_traefik_entrypoint_name }}" @@ -5938,7 +5963,7 @@ matrix_conduit_container_labels_traefik_entrypoints: "{{ traefik_entrypoint_prim matrix_conduit_container_labels_traefik_tls_certResolver: "{{ traefik_certResolver_primary }}" matrix_conduit_container_labels_public_client_root_redirection_enabled: "{{ matrix_conduit_container_labels_public_client_root_redirection_url != '' }}" -matrix_conduit_container_labels_public_client_root_redirection_url: "{{ (('https://' if matrix_playbook_ssl_enabled else 'http://') + matrix_server_fqn_element) if matrix_client_element_enabled else '' }}" +matrix_conduit_container_labels_public_client_root_redirection_url: "{{ matrix_playbook_public_client_root_redirection_url }}" matrix_conduit_container_labels_public_federation_api_traefik_hostname: "{{ matrix_server_fqn_matrix_federation }}" matrix_conduit_container_labels_public_federation_api_traefik_entrypoints: "{{ matrix_federation_traefik_entrypoint_name }}" @@ -5996,7 +6021,7 @@ matrix_continuwuity_container_labels_traefik_entrypoints: "{{ traefik_entrypoint matrix_continuwuity_container_labels_traefik_tls_certResolver: "{{ traefik_certResolver_primary }}" matrix_continuwuity_container_labels_public_client_root_redirection_enabled: "{{ matrix_continuwuity_container_labels_public_client_root_redirection_url != '' }}" -matrix_continuwuity_container_labels_public_client_root_redirection_url: "{{ (('https://' if matrix_playbook_ssl_enabled else 'http://') + matrix_server_fqn_element) if matrix_client_element_enabled else '' }}" +matrix_continuwuity_container_labels_public_client_root_redirection_url: "{{ matrix_playbook_public_client_root_redirection_url }}" matrix_continuwuity_container_labels_public_federation_api_traefik_hostname: "{{ matrix_server_fqn_matrix_federation }}" matrix_continuwuity_container_labels_public_federation_api_traefik_entrypoints: "{{ matrix_federation_traefik_entrypoint_name }}" @@ -6057,7 +6082,7 @@ matrix_tuwunel_container_labels_traefik_entrypoints: "{{ traefik_entrypoint_prim matrix_tuwunel_container_labels_traefik_tls_certResolver: "{{ traefik_certResolver_primary }}" matrix_tuwunel_container_labels_public_client_root_redirection_enabled: "{{ matrix_tuwunel_container_labels_public_client_root_redirection_url != '' }}" -matrix_tuwunel_container_labels_public_client_root_redirection_url: "{{ (('https://' if matrix_playbook_ssl_enabled else 'http://') + matrix_server_fqn_element) if matrix_client_element_enabled else '' }}" +matrix_tuwunel_container_labels_public_client_root_redirection_url: "{{ matrix_playbook_public_client_root_redirection_url }}" matrix_tuwunel_container_labels_public_client_synapse_admin_api_enabled: "{{ matrix_ketesa_enabled or matrix_element_admin_enabled }}" matrix_tuwunel_container_labels_internal_client_synapse_admin_api_enabled: "{{ (matrix_bot_draupnir_enabled and matrix_bot_draupnir_admin_api_enabled) }}"