1
0
mirror of https://github.com/containous/traefik.git synced 2025-03-19 18:50:12 +03:00

Fix rewrite-target Annotation behavior

This commit is contained in:
Daniel Tomcej 2018-07-09 16:26:03 -06:00 committed by Traefiker Bot
parent ba2046491a
commit 9374d6b3b9
2 changed files with 3 additions and 2 deletions

View File

@ -538,7 +538,8 @@ func getRuleForPath(pa extensionsv1beta1.HTTPIngressPath, i *extensionsv1beta1.I
if pathReplaceAnnotation != "" {
return "", fmt.Errorf("rewrite-target must not be used together with annotation %q", pathReplaceAnnotation)
}
rules = append(rules, ruleTypeReplacePath+":"+rewriteTarget)
rewriteTargetRule := fmt.Sprintf("ReplacePathRegex: ^%s/(.*) %s/$1", pa.Path, strings.TrimRight(rewriteTarget, "/"))
rules = append(rules, rewriteTargetRule)
pathReplaceAnnotation = annotationKubernetesRewriteTarget
}

View File

@ -1371,7 +1371,7 @@ rateset:
frontend("rewrite/api",
passHostHeader(),
routes(
route("/api", "PathPrefix:/api;ReplacePath:/"),
route("/api", "PathPrefix:/api;ReplacePathRegex: ^/api/(.*) /$1"),
route("rewrite", "Host:rewrite")),
),
frontend("error-pages/errorpages",