Enable (Traefik compression middleware)-assisted compression for Cinny, Element & Hydrogen

This commit is contained in:
Slavi Pantaleev
2024-11-14 15:53:58 +02:00
parent 5cad571296
commit 4a61bd49e3
10 changed files with 48 additions and 9 deletions

View File

@ -48,6 +48,11 @@ matrix_client_element_container_labels_traefik_entrypoints: web-secure
matrix_client_element_container_labels_traefik_tls: "{{ matrix_client_element_container_labels_traefik_entrypoints != 'web' }}"
matrix_client_element_container_labels_traefik_tls_certResolver: default # noqa var-naming
# Controls whether a compression middleware will be injected into the middlewares list.
# This compression middleware is supposed to be defined elsewhere (using labels or a File provider, etc.) and is merely referenced by this router.
matrix_client_element_container_labels_traefik_compression_middleware_enabled: false
matrix_client_element_container_labels_traefik_compression_middleware_name: ""
# Controls which additional headers to attach to all HTTP responses.
# To add your own headers, use `matrix_client_element_container_labels_traefik_additional_response_headers_custom`
matrix_client_element_container_labels_traefik_additional_response_headers: "{{ matrix_client_element_container_labels_traefik_additional_response_headers_auto | combine(matrix_client_element_container_labels_traefik_additional_response_headers_custom) }}"

View File

@ -4,10 +4,11 @@
ansible.builtin.fail:
msg: >
You need to define a required configuration setting (`{{ item }}`) for using Element Web.
when: "vars[item] == ''"
when: "item.when | bool and vars[item.name] == ''"
with_items:
- matrix_client_element_default_hs_url
- matrix_client_element_container_network
- {'name': 'matrix_client_element_default_hs_url', when: true}
- {'name': 'matrix_client_element_container_network', when: true}
- {'name': 'matrix_client_element_container_labels_traefik_compression_middleware_name', when: "{{ matrix_client_element_container_labels_traefik_compression_middleware_enabled }}"}
- name: Fail if Element location sharing enabled, but no tile server defined
ansible.builtin.fail:

View File

@ -9,6 +9,10 @@ traefik.http.services.matrix-client-element.loadbalancer.server.port=8080
{% set middlewares = [] %}
{% if matrix_client_element_container_labels_traefik_compression_middleware_enabled %}
{% set middlewares = middlewares + [matrix_client_element_container_labels_traefik_compression_middleware_name] %}
{% endif %}
{% if matrix_client_element_container_labels_traefik_path_prefix != '/' %}
traefik.http.middlewares.matrix-client-element-slashless-redirect.redirectregex.regex=({{ matrix_client_element_container_labels_traefik_path_prefix | quote }})$
traefik.http.middlewares.matrix-client-element-slashless-redirect.redirectregex.replacement=${1}/