app-root on non-explicit path include "/" in the redirect

This commit is contained in:
Doctori 2019-02-05 17:30:07 +01:00 committed by Traefiker Bot
parent 16c283c91a
commit f0ee2890b2
2 changed files with 6 additions and 2 deletions

View file

@ -945,8 +945,12 @@ func getFrontendRedirect(i *extensionsv1beta1.Ingress, baseName, path string) *t
permanent := getBoolValue(i.Annotations, annotationKubernetesRedirectPermanent, false)
if appRoot := getStringValue(i.Annotations, annotationKubernetesAppRoot, ""); appRoot != "" && (path == "/" || path == "") {
regex := fmt.Sprintf("%s$", baseName)
if path == "" {
regex = fmt.Sprintf("%s/$", baseName)
}
return &types.Redirect{
Regex: fmt.Sprintf("%s$", baseName),
Regex: regex,
Replacement: fmt.Sprintf("%s/%s", strings.TrimRight(baseName, "/"), strings.TrimLeft(appRoot, "/")),
Permanent: permanent,
}

View file

@ -1712,7 +1712,7 @@ rateset:
),
frontend("root3",
passHostHeader(),
redirectRegex("root3$", "root3/root"),
redirectRegex("root3/$", "root3/root"),
routes(
route("root3", "Host:root3"),
),