Make base domain root path redirect regex configurable

This commit is contained in:
Slavi Pantaleev 2024-02-11 09:03:48 +02:00
parent 52d4b5083d
commit cf9388c546
2 changed files with 2 additions and 1 deletions

View File

@ -83,6 +83,7 @@ matrix_static_files_container_labels_base_domain_traefik_tls: "{{ matrix_static_
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. # 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_enabled: false
matrix_static_files_container_labels_base_domain_root_path_redirection_regex: "^https://{{ matrix_static_files_container_labels_base_domain_traefik_hostname }}{{ matrix_static_files_container_labels_base_domain_traefik_path_prefix }}$"
matrix_static_files_container_labels_base_domain_root_path_redirection_url: "" 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.

View File

@ -59,7 +59,7 @@ traefik.http.routers.{{ matrix_static_files_identifier }}-well-known.tls.certRes
{% set middlewares = [] %} {% set middlewares = [] %}
{% if matrix_static_files_container_labels_base_domain_root_path_redirection_enabled %} {% 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.regex={{ matrix_static_files_container_labels_base_domain_root_path_redirection_regex }}
traefik.http.middlewares.{{ matrix_static_files_identifier }}-root-path-redirect.redirectregex.replacement={{ matrix_static_files_container_labels_base_domain_root_path_redirection_url }} 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'] %} {% set middlewares = middlewares + [matrix_static_files_identifier + '-root-path-redirect'] %}
{% endif %} {% endif %}