Fix kubernetes path prefix rule with rewrite-target
This commit is contained in:
parent
419d46c958
commit
0f09551a76
2 changed files with 4 additions and 4 deletions
|
@ -325,13 +325,13 @@ func getRuleForPath(pa v1beta1.HTTPIngressPath, i *v1beta1.Ingress) string {
|
||||||
ruleType = ruleTypePathPrefix
|
ruleType = ruleTypePathPrefix
|
||||||
}
|
}
|
||||||
|
|
||||||
rule := ruleType + ":" + pa.Path
|
rules := []string{ruleType + ":" + pa.Path}
|
||||||
|
|
||||||
if rewriteTarget := i.Annotations[annotationKubernetesRewriteTarget]; rewriteTarget != "" {
|
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 {
|
func (p *Provider) getPriority(path v1beta1.HTTPIngressPath, i *v1beta1.Ingress) int {
|
||||||
|
|
|
@ -1728,7 +1728,7 @@ func TestIngressAnnotations(t *testing.T) {
|
||||||
PassHostHeader: true,
|
PassHostHeader: true,
|
||||||
Routes: map[string]types.Route{
|
Routes: map[string]types.Route{
|
||||||
"/api": {
|
"/api": {
|
||||||
Rule: "ReplacePath:/",
|
Rule: "PathPrefix:/api;ReplacePath:/",
|
||||||
},
|
},
|
||||||
"rewrite": {
|
"rewrite": {
|
||||||
Rule: "Host:rewrite",
|
Rule: "Host:rewrite",
|
||||||
|
|
Loading…
Reference in a new issue