Make base domain root path redirect also handle URLs with query strings (passing them along)

Previously `https://example.com` and `https://example.com/` would be
redirected to `https://matrix.example.com`.

However, `https://example.com/?something` was not handled and was tried
to be served as a file by matrix-static-files for this base domain.

From now on, paths containing query strings will be handled as well
and the query string will be passed along.
Example: `https://example.com/?something` -> `https://matrix.example.com/?something`
This commit is contained in:
Slavi Pantaleev 2025-03-11 19:05:18 +02:00
parent ccab72aa2e
commit 1313f1e414
2 changed files with 2 additions and 2 deletions

View File

@ -6094,7 +6094,7 @@ matrix_static_files_container_labels_base_domain_traefik_hostname: "{{ matrix_do
# If we're not serving a static webpage, serve a redirect instead of a 404. # 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_enabled: "{{ not matrix_static_files_file_index_html_enabled }}"
matrix_static_files_container_labels_base_domain_root_path_redirection_url: "{{ ('https://' if matrix_playbook_ssl_enabled else 'http://') + matrix_server_fqn_matrix }}" matrix_static_files_container_labels_base_domain_root_path_redirection_url: "{{ ('https://' if matrix_playbook_ssl_enabled else 'http://') + matrix_server_fqn_matrix }}/${1}"
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 '' }}"

View File

@ -91,7 +91,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: "^{{ matrix_static_files_scheme }}://{{ 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_regex: "^{{ matrix_static_files_scheme }}://{{ 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.