This is a break in backward-compatibility for people disabling `index.html` creation via the playbook but are managing their static website files in another way (AUX role, etc).pull/3142/head
| @@ -4848,6 +4848,10 @@ matrix_static_files_container_labels_well_known_matrix_endpoint_traefik_hostname | |||||
| # but we pass the hostname, so that enabling it is easy. | # but we pass the hostname, so that enabling it is easy. | ||||
| matrix_static_files_container_labels_base_domain_traefik_hostname: "{{ matrix_domain }}" | matrix_static_files_container_labels_base_domain_traefik_hostname: "{{ matrix_domain }}" | ||||
| # If we're not serving a static webpage, serve a redirect instead of a 404. | |||||
| matrix_static_files_container_labels_base_domain_root_path_redirection_enabled: "{{ not matrix_static_files_file_index_html_enabled }}" | |||||
| matrix_static_files_container_labels_base_domain_root_path_redirection_url: "https://{{ matrix_server_fqn_matrix }}" | |||||
| matrix_static_files_file_matrix_client_property_io_element_jitsi_preferred_domain: "{{ matrix_server_fqn_jitsi if jitsi_enabled else '' }}" | matrix_static_files_file_matrix_client_property_io_element_jitsi_preferred_domain: "{{ matrix_server_fqn_jitsi if jitsi_enabled else '' }}" | ||||
| matrix_static_files_file_matrix_client_property_org_matrix_msc3575_proxy_url: "{{ matrix_homeserver_sliding_sync_url }}" | matrix_static_files_file_matrix_client_property_org_matrix_msc3575_proxy_url: "{{ matrix_homeserver_sliding_sync_url }}" | ||||
| @@ -81,6 +81,9 @@ matrix_static_files_container_labels_base_domain_traefik_priority: 0 | |||||
| matrix_static_files_container_labels_base_domain_traefik_entrypoints: "{{ matrix_static_files_container_labels_traefik_entrypoints }}" | matrix_static_files_container_labels_base_domain_traefik_entrypoints: "{{ matrix_static_files_container_labels_traefik_entrypoints }}" | ||||
| matrix_static_files_container_labels_base_domain_traefik_tls: "{{ matrix_static_files_container_labels_base_domain_traefik_entrypoints != 'web' }}" | matrix_static_files_container_labels_base_domain_traefik_tls: "{{ matrix_static_files_container_labels_base_domain_traefik_entrypoints != 'web' }}" | ||||
| matrix_static_files_container_labels_base_domain_traefik_tls_certResolver: "{{ matrix_static_files_container_labels_traefik_tls_certResolver }}" # noqa var-naming | matrix_static_files_container_labels_base_domain_traefik_tls_certResolver: "{{ matrix_static_files_container_labels_traefik_tls_certResolver }}" # noqa var-naming | ||||
| # Controls whether the root path (/) at the base domain would respond with a redirect to some URL. | |||||
| matrix_static_files_container_labels_base_domain_root_path_redirection_enabled: false | |||||
| matrix_static_files_container_labels_base_domain_root_path_redirection_url: "" | |||||
| # matrix_static_files_container_labels_additional_labels contains a multiline string with additional labels to add to the container label file. | # matrix_static_files_container_labels_additional_labels contains a multiline string with additional labels to add to the container label file. | ||||
| # See `../templates/labels.j2` for details. | # See `../templates/labels.j2` for details. | ||||
| @@ -343,6 +346,9 @@ matrix_static_files_file_matrix_support_configuration: "{{ matrix_static_files_f | |||||
| # | # | ||||
| # You can also use the auxiliary role (https://github.com/mother-of-all-self-hosting/ansible-role-aux) to create files in | # You can also use the auxiliary role (https://github.com/mother-of-all-self-hosting/ansible-role-aux) to create files in | ||||
| # the public directory (matrix_static_files_public_path) by yourself. | # the public directory (matrix_static_files_public_path) by yourself. | ||||
| # If you're disabling this but are preparing some HTML files by yourself, | |||||
| # consider explicitly disabling `matrix_static_files_container_labels_base_domain_root_path_redirection_enabled` as well. | |||||
| # The default behavior when this is disabled is to enable root-path-redirection. | |||||
| # | # | ||||
| # Because you may wish to manage these static files yourself, disabling this variable will intentionally not delete an already existing `index.html` file. | # Because you may wish to manage these static files yourself, disabling this variable will intentionally not delete an already existing `index.html` file. | ||||
| matrix_static_files_file_index_html_enabled: "{{ matrix_static_files_container_labels_base_domain_enabled }}" | matrix_static_files_file_index_html_enabled: "{{ matrix_static_files_container_labels_base_domain_enabled }}" | ||||
| @@ -11,3 +11,5 @@ | |||||
| - {'name': 'matrix_static_files_container_labels_base_domain_traefik_hostname', when: "{{ matrix_static_files_container_labels_base_domain_enabled }}"} | - {'name': 'matrix_static_files_container_labels_base_domain_traefik_hostname', when: "{{ matrix_static_files_container_labels_base_domain_enabled }}"} | ||||
| - {'name': 'matrix_static_files_container_labels_base_domain_traefik_path_prefix', when: "{{ matrix_static_files_container_labels_base_domain_enabled }}"} | - {'name': 'matrix_static_files_container_labels_base_domain_traefik_path_prefix', when: "{{ matrix_static_files_container_labels_base_domain_enabled }}"} | ||||
| - {'name': 'matrix_static_files_container_labels_base_domain_root_path_redirection_url', when: "{{ matrix_static_files_container_labels_base_domain_enabled and matrix_static_files_container_labels_base_domain_root_path_redirection_enabled }}"} | |||||
| @@ -56,12 +56,24 @@ traefik.http.routers.{{ matrix_static_files_identifier }}-well-known.tls.certRes | |||||
| # # | # # | ||||
| ############################################################ | ############################################################ | ||||
| {% set middlewares = [] %} | |||||
| {% if matrix_static_files_container_labels_base_domain_root_path_redirection_enabled %} | |||||
| traefik.http.middlewares.{{ matrix_static_files_identifier }}-root-path-redirect.redirectregex.regex=^https://{{ matrix_static_files_container_labels_base_domain_traefik_hostname }}{{ matrix_static_files_container_labels_base_domain_traefik_path_prefix }}$ | |||||
| traefik.http.middlewares.{{ matrix_static_files_identifier }}-root-path-redirect.redirectregex.replacement={{ matrix_static_files_container_labels_base_domain_root_path_redirection_url }} | |||||
| {% set middlewares = middlewares + [matrix_static_files_identifier + '-root-path-redirect'] %} | |||||
| {% endif %} | |||||
| traefik.http.routers.{{ matrix_static_files_identifier }}-base-domain.rule={{ matrix_static_files_container_labels_base_domain_traefik_rule }} | traefik.http.routers.{{ matrix_static_files_identifier }}-base-domain.rule={{ matrix_static_files_container_labels_base_domain_traefik_rule }} | ||||
| {% if matrix_static_files_container_labels_base_domain_traefik_priority | int > 0 %} | {% if matrix_static_files_container_labels_base_domain_traefik_priority | int > 0 %} | ||||
| traefik.http.routers.{{ matrix_static_files_identifier }}-base-domain.priority={{ matrix_static_files_container_labels_base_domain_traefik_priority }} | traefik.http.routers.{{ matrix_static_files_identifier }}-base-domain.priority={{ matrix_static_files_container_labels_base_domain_traefik_priority }} | ||||
| {% endif %} | {% endif %} | ||||
| {% if middlewares | length > 0 %} | |||||
| traefik.http.routers.{{ matrix_static_files_identifier }}-base-domain.middlewares={{ middlewares | join(',') }} | |||||
| {% endif %} | |||||
| traefik.http.routers.{{ matrix_static_files_identifier }}-base-domain.service={{ matrix_static_files_identifier }} | traefik.http.routers.{{ matrix_static_files_identifier }}-base-domain.service={{ matrix_static_files_identifier }} | ||||
| traefik.http.routers.{{ matrix_static_files_identifier }}-base-domain.entrypoints={{ matrix_static_files_container_labels_base_domain_traefik_entrypoints }} | traefik.http.routers.{{ matrix_static_files_identifier }}-base-domain.entrypoints={{ matrix_static_files_container_labels_base_domain_traefik_entrypoints }} | ||||
| traefik.http.routers.{{ matrix_static_files_identifier }}-base-domain.tls={{ matrix_static_files_container_labels_base_domain_traefik_tls | to_json }} | traefik.http.routers.{{ matrix_static_files_identifier }}-base-domain.tls={{ matrix_static_files_container_labels_base_domain_traefik_tls | to_json }} | ||||