Skip to content
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

Merged
merged 2 commits into from
Nov 14, 2023

Conversation

johnlanni
Copy link
Collaborator

Ⅰ. 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

@johnlanni
Copy link
Collaborator Author

cc @SpecialYang

@codecov-commenter
Copy link

codecov-commenter commented Nov 14, 2023

Codecov Report

Merging #636 (4fa07ef) into main (5174397) will increase coverage by 0.05%.
The diff coverage is 40.74%.

Additional details and impacted files

Impacted file tree graph

@@            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              
Files Coverage Δ
pkg/ingress/kube/annotations/annotations.go 32.97% <100.00%> (+7.09%) ⬆️
pkg/ingress/kube/ingress/controller.go 62.31% <0.00%> (ø)
pkg/ingress/kube/ingressv1/controller.go 5.42% <0.00%> (ø)

@johnlanni johnlanni merged commit 88c0386 into alibaba:main Nov 14, 2023
Copy link
Collaborator

@SpecialYang SpecialYang left a 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, `$\`) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$\ 这是什么?

Copy link
Collaborator Author

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"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的去掉的原因?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不带 use-regex 时,通过 target 或 path 里的特殊字符来判定是否启用正则匹配

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants