app-root on non-explicit path include "/" in the redirect
This commit is contained in:
parent
16c283c91a
commit
f0ee2890b2
2 changed files with 6 additions and 2 deletions
|
@ -945,8 +945,12 @@ func getFrontendRedirect(i *extensionsv1beta1.Ingress, baseName, path string) *t
|
||||||
permanent := getBoolValue(i.Annotations, annotationKubernetesRedirectPermanent, false)
|
permanent := getBoolValue(i.Annotations, annotationKubernetesRedirectPermanent, false)
|
||||||
|
|
||||||
if appRoot := getStringValue(i.Annotations, annotationKubernetesAppRoot, ""); appRoot != "" && (path == "/" || path == "") {
|
if appRoot := getStringValue(i.Annotations, annotationKubernetesAppRoot, ""); appRoot != "" && (path == "/" || path == "") {
|
||||||
|
regex := fmt.Sprintf("%s$", baseName)
|
||||||
|
if path == "" {
|
||||||
|
regex = fmt.Sprintf("%s/$", baseName)
|
||||||
|
}
|
||||||
return &types.Redirect{
|
return &types.Redirect{
|
||||||
Regex: fmt.Sprintf("%s$", baseName),
|
Regex: regex,
|
||||||
Replacement: fmt.Sprintf("%s/%s", strings.TrimRight(baseName, "/"), strings.TrimLeft(appRoot, "/")),
|
Replacement: fmt.Sprintf("%s/%s", strings.TrimRight(baseName, "/"), strings.TrimLeft(appRoot, "/")),
|
||||||
Permanent: permanent,
|
Permanent: permanent,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1712,7 +1712,7 @@ rateset:
|
||||||
),
|
),
|
||||||
frontend("root3",
|
frontend("root3",
|
||||||
passHostHeader(),
|
passHostHeader(),
|
||||||
redirectRegex("root3$", "root3/root"),
|
redirectRegex("root3/$", "root3/root"),
|
||||||
routes(
|
routes(
|
||||||
route("root3", "Host:root3"),
|
route("root3", "Host:root3"),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue