From 04eb6cee8b55242e1473da131910103c65c7d8b5 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Mon, 3 Apr 2023 15:24:50 +0300 Subject: [PATCH] Make slashless-redirect safer --- templates/labels.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/labels.j2 b/templates/labels.j2 index cd78300..6fcaaa1 100644 --- a/templates/labels.j2 +++ b/templates/labels.j2 @@ -8,7 +8,7 @@ traefik.docker.network={{ nextcloud_container_labels_traefik_docker_network }} {% set middlewares = [] %} {% if nextcloud_container_labels_traefik_path_prefix != '/' %} -traefik.http.middlewares.{{ nextcloud_identifier }}-slashless-redirect.redirectregex.regex=({{ nextcloud_container_labels_traefik_path_prefix | quote }})$ +traefik.http.middlewares.{{ nextcloud_identifier }}-slashless-redirect.redirectregex.regex=^({{ nextcloud_container_labels_traefik_path_prefix | quote }})$ traefik.http.middlewares.{{ nextcloud_identifier }}-slashless-redirect.redirectregex.replacement=${1}/ {% set middlewares = middlewares + [nextcloud_identifier + '-slashless-redirect'] %} {% endif %}