Default to root-path-redirection on the base domain if index.html creation is disabled
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).
This commit is contained in:
@ -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_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
|
||||
# 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.
|
||||
# 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
|
||||
# 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.
|
||||
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_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 }}
|
||||
|
||||
{% 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 }}
|
||||
{% 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.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 }}
|
||||
|
Reference in New Issue
Block a user