Ensure a single / is used for the PathPrefix

This commit is contained in:
Daniel Berteaud 2024-01-29 10:43:30 +01:00
parent bdf6f35c55
commit 1b8667670a

View File

@ -27,7 +27,7 @@
"[[ .traefik.instance ]].http.routers.[[ .traefik.router ]].rule=[[ .traefik.rule ]]",
[[- else if .traefik.auto_rule ]]
"[[ .traefik.instance ]].http.routers.[[ .traefik.router ]].rule=Host(`[[ (urlParse .public_url).Hostname ]]`)
[[- if not (regexp.Match "^/?$" (urlParse .public_url).Path) ]] && PathPrefix(`[[ (urlParse .public_url).Path ]]`)[[ end ]]",
[[- if not (regexp.Match "^/?$" (urlParse .public_url).Path) ]] && PathPrefix(`[[ (urlParse .public_url).Path | regexp.Replace "^//" "/" ]]`)[[ end ]]",
[[- end ]]
[[- if and (has .traefik "csp") (isKind "map" .traefik.csp) ]]
"[[ .traefik.instance ]].http.middlewares.csp-[[ .traefik.router ]].headers.contentsecuritypolicy=[[ range $k, $v := .traefik.csp ]][[ $k ]] [[ $v ]];[[ end ]]",