Add Traefik labels to expose /.well-known/element on the matrix. domain

Some Element Call setup resources say that `/.well-known/element/element.json` should be served on the base domain
and should contain content like this:

```json
{
	"call": {
		"widget_url": "https://call.element.example.com"
	}
}
```

We were already generating the file via `matrix-static-files`, but weren't serving it yet.

This patch makes sure it's served on the `matrix.` domain, which allows
people to set up serving on the base domain via a redirect or reverse-proxying.

Related to https://github.com/spantaleev/matrix-docker-ansible-deploy/pull/3562
This commit is contained in:
Slavi Pantaleev
2025-03-17 07:51:04 +02:00
parent c9951194fe
commit 248463b58b
4 changed files with 71 additions and 11 deletions

View File

@ -57,7 +57,7 @@ matrix_static_files_container_labels_traefik_docker_network: "{{ matrix_static_f
matrix_static_files_container_labels_traefik_entrypoints: web-secure
matrix_static_files_container_labels_traefik_tls_certResolver: default # noqa var-naming
# Controls whether labels will be added that expose the well-known public endpoint on the Matrix domain.
# Controls whether labels will be added that expose the `/.well-known/matrix` endpoint on the Matrix domain.
matrix_static_files_container_labels_well_known_matrix_endpoint_enabled: true
matrix_static_files_container_labels_well_known_matrix_endpoint_traefik_hostname: ''
matrix_static_files_container_labels_well_known_matrix_endpoint_traefik_path_prefix: /.well-known/matrix
@ -72,6 +72,21 @@ matrix_static_files_container_labels_well_known_matrix_endpoint_traefik_tls_cert
matrix_static_files_container_labels_well_known_matrix_endpoint_middleware_compress_enabled: true
matrix_static_files_container_labels_well_known_matrix_endpoint_middleware_compress_minResponseBodyBytes: 100 # noqa var-naming
# Controls whether labels will be added that expose the `/.well-known/element` endpoint on the Matrix domain.
matrix_static_files_container_labels_well_known_element_endpoint_enabled: true
matrix_static_files_container_labels_well_known_element_endpoint_traefik_hostname: ''
matrix_static_files_container_labels_well_known_element_endpoint_traefik_path_prefix: /.well-known/element
matrix_static_files_container_labels_well_known_element_endpoint_traefik_rule: "Host(`{{ matrix_static_files_container_labels_well_known_element_endpoint_traefik_hostname }}`) && PathPrefix(`{{ matrix_static_files_container_labels_well_known_element_endpoint_traefik_path_prefix }}`)"
matrix_static_files_container_labels_well_known_element_endpoint_traefik_priority: 0
matrix_static_files_container_labels_well_known_element_endpoint_traefik_entrypoints: "{{ matrix_static_files_container_labels_traefik_entrypoints }}"
matrix_static_files_container_labels_well_known_element_endpoint_traefik_tls: "{{ matrix_static_files_container_labels_well_known_element_endpoint_traefik_entrypoints != 'web' }}"
matrix_static_files_container_labels_well_known_element_endpoint_traefik_tls_certResolver: "{{ matrix_static_files_container_labels_traefik_tls_certResolver }}" # noqa var-naming
# Controls whether the compress middleware (https://doc.traefik.io/traefik/middlewares/http/compress/) will be enabled for this router.
# The web-server only compresses known file types and our /.well-known/matrix/* files have no file extension.
# As such, they are not being compressed there and we compress them at the Traefik level.
matrix_static_files_container_labels_well_known_element_endpoint_middleware_compress_enabled: true
matrix_static_files_container_labels_well_known_element_endpoint_middleware_compress_minResponseBodyBytes: 100 # noqa var-naming
# Controls whether labels will be added that serve the base domain.
#
# This is similar to `matrix_static_files_container_labels_well_known_matrix_endpoint_*`, but does more.