-
Notifications
You must be signed in to change notification settings - Fork 557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
more compatiable with nginx's rewrite #636
more compatiable with nginx's rewrite #636
Conversation
cc @SpecialYang |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #636 +/- ##
==========================================
+ Coverage 35.46% 35.51% +0.05%
==========================================
Files 71 71
Lines 10259 10268 +9
==========================================
+ Hits 3638 3647 +9
Misses 6333 6333
Partials 288 288
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不是特别明白,这里是只要path或者target里有正则的标识,就认为路由类型是正则吗?
那匹配顺序呢?
if strings.ContainsAny(path, `\.+*?()|[]{}^$`) { | ||
return true | ||
} | ||
if strings.ContainsAny(i.Rewrite.RewriteTarget, `$\`) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$\ 这是什么?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$1 $2是nginx的捕获方式,\1 \2 是 envoy 的捕获方式
@@ -17,7 +17,6 @@ kind: Ingress | |||
metadata: | |||
annotations: | |||
nginx.ingress.kubernetes.io/rewrite-target: "/$1" | |||
nginx.ingress.kubernetes.io/use-regex: "true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的去掉的原因?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不带 use-regex 时,通过 target 或 path 里的特殊字符来判定是否启用正则匹配
Ⅰ. Describe what this PR did
Ⅱ. Does this pull request fix one issue?
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews