diff --git a/provider/kubernetes/kubernetes.go b/provider/kubernetes/kubernetes.go index a7fd6ecb6..f62293976 100644 --- a/provider/kubernetes/kubernetes.go +++ b/provider/kubernetes/kubernetes.go @@ -355,13 +355,13 @@ func getRuleForPath(pa v1beta1.HTTPIngressPath, i *v1beta1.Ingress) string { ruleType = ruleTypePathPrefix } - rule := ruleType + ":" + pa.Path + rules := []string{ruleType + ":" + pa.Path} if rewriteTarget := i.Annotations[annotationKubernetesRewriteTarget]; rewriteTarget != "" { - rule = ruleTypeReplacePath + ":" + rewriteTarget + rules = append(rules, ruleTypeReplacePath+":"+rewriteTarget) } - return rule + return strings.Join(rules, ";") } func (p *Provider) getPriority(path v1beta1.HTTPIngressPath, i *v1beta1.Ingress) int { diff --git a/provider/kubernetes/kubernetes_test.go b/provider/kubernetes/kubernetes_test.go index 767dbfe1f..df98a89b4 100644 --- a/provider/kubernetes/kubernetes_test.go +++ b/provider/kubernetes/kubernetes_test.go @@ -1543,7 +1543,7 @@ func TestIngressAnnotations(t *testing.T) { PassHostHeader: true, Routes: map[string]types.Route{ "/api": { - Rule: "ReplacePath:/", + Rule: "PathPrefix:/api;ReplacePath:/", }, "rewrite": { Rule: "Host:rewrite",