mirror of
https://github.com/containous/traefik.git
synced 2025-10-19 07:33:17 +03:00
Allow empty path with App-root annotation
This commit is contained in:
committed by
Traefiker Bot
parent
ee19e66aba
commit
4db0dd9a7f
@@ -939,7 +939,7 @@ func loadAuthTLSSecret(namespace, secretName string, k8sClient Client) (string,
|
|||||||
func getFrontendRedirect(i *extensionsv1beta1.Ingress, baseName, path string) *types.Redirect {
|
func getFrontendRedirect(i *extensionsv1beta1.Ingress, baseName, path string) *types.Redirect {
|
||||||
permanent := getBoolValue(i.Annotations, annotationKubernetesRedirectPermanent, false)
|
permanent := getBoolValue(i.Annotations, annotationKubernetesRedirectPermanent, false)
|
||||||
|
|
||||||
if appRoot := getStringValue(i.Annotations, annotationKubernetesAppRoot, ""); appRoot != "" && path == "/" {
|
if appRoot := getStringValue(i.Annotations, annotationKubernetesAppRoot, ""); appRoot != "" && (path == "/" || path == "") {
|
||||||
return &types.Redirect{
|
return &types.Redirect{
|
||||||
Regex: fmt.Sprintf("%s$", baseName),
|
Regex: fmt.Sprintf("%s$", baseName),
|
||||||
Replacement: fmt.Sprintf("%s/%s", strings.TrimRight(baseName, "/"), strings.TrimLeft(appRoot, "/")),
|
Replacement: fmt.Sprintf("%s/%s", strings.TrimRight(baseName, "/"), strings.TrimLeft(appRoot, "/")),
|
||||||
|
@@ -1299,6 +1299,18 @@ rateset:
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
buildIngress(
|
||||||
|
iNamespace("testing"),
|
||||||
|
iAnnotation(annotationKubernetesAppRoot, "/root"),
|
||||||
|
iRules(
|
||||||
|
iRule(
|
||||||
|
iHost("root3"),
|
||||||
|
iPaths(
|
||||||
|
onePath(iBackend("service1", intstr.FromInt(80))),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
buildIngress(
|
buildIngress(
|
||||||
iNamespace("testing"),
|
iNamespace("testing"),
|
||||||
iAnnotation(annotationKubernetesIngressClass, "traefik"),
|
iAnnotation(annotationKubernetesIngressClass, "traefik"),
|
||||||
@@ -1503,6 +1515,11 @@ rateset:
|
|||||||
servers(),
|
servers(),
|
||||||
lbMethod("wrr"),
|
lbMethod("wrr"),
|
||||||
),
|
),
|
||||||
|
backend("root3",
|
||||||
|
servers(
|
||||||
|
server("http://example.com", weight(1))),
|
||||||
|
lbMethod("wrr"),
|
||||||
|
),
|
||||||
backend("protocol/valid",
|
backend("protocol/valid",
|
||||||
servers(
|
servers(
|
||||||
server("h2c://example.com", weight(1)),
|
server("h2c://example.com", weight(1)),
|
||||||
@@ -1658,6 +1675,13 @@ rateset:
|
|||||||
route("root", "Host:root"),
|
route("root", "Host:root"),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
frontend("root3",
|
||||||
|
passHostHeader(),
|
||||||
|
redirectRegex("root3$", "root3/root"),
|
||||||
|
routes(
|
||||||
|
route("root3", "Host:root3"),
|
||||||
|
),
|
||||||
|
),
|
||||||
frontend("protocol/valid",
|
frontend("protocol/valid",
|
||||||
passHostHeader(),
|
passHostHeader(),
|
||||||
routes(
|
routes(
|
||||||
|
Reference in New Issue
Block a user