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

【建议】配置路由策略时对“非”表达式的支持 #937

Open
XavierGrool opened this issue May 14, 2024 · 1 comment
Open

Comments

@XavierGrool
Copy link

使用场景

在配置路由的路径、请求头、请求参数时,有需要表达“非”关系的场景。例如:现有一个路由/animal,在配置请求头时,希望只要符合 animal≠cat 时都导去 dog 的页面。

已尝试的方法

目前在 Higress Console 上,对于路径、请求头和请求参数的匹配条件都支持正则匹配:
image

所以尝试过使用 负向前瞻断言 来表达非的关系,如:
5414b85301fe14a5be2efb0e0d17f3f

但是并没有成功

咨询过 zty,他说目前还不支持这种正则语法,但是我们这边确实存在这样的需求。

附上 Traefik 的做法

之前我们也了解过 Traefik,它对路由策略的与或非是这样解决的:
image

@johnlanni
Copy link
Collaborator

这个可能短期不会支持,一方面 Ingress API/Gateway API 都没有对与非匹配这种路由条件的定义;
另一方面,在主流的 CPP 正则库如 RE2,以及 HyperScan 中都没有对 zero width asserts 的支持。

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

No branches or pull requests

2 participants