Fix kubernetes path prefix rule with rewrite-target

This commit is contained in:
Kwok-kuen Cheung 2017-11-27 18:22:03 +08:00 committed by Traefiker
parent 419d46c958
commit 0f09551a76
2 changed files with 4 additions and 4 deletions

View file

@ -325,13 +325,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 {

View file

@ -1728,7 +1728,7 @@ func TestIngressAnnotations(t *testing.T) {
PassHostHeader: true,
Routes: map[string]types.Route{
"/api": {
Rule: "ReplacePath:/",
Rule: "PathPrefix:/api;ReplacePath:/",
},
"rewrite": {
Rule: "Host:rewrite",