是否可以在 Match-Path-rules 中使用正则表达式来匹配一般更广泛的 url 模式并能够匹配非常具体的模式。我不想使用
{**catch-all}
但例如像 /api/\w{1,3}-\d{1,9}
... 这样的普通正则表达式
这可以通过 Yarp 以某种方式实现吗?
"Match": {
"Path": "<Regular expressions here or ?>"
}
你可以这样写:
"Match": {
"Path": "/api/{path:regex(\\w{{1,3}}-\\d{{1,9}})}"
}
或
"Match": {
"Path": "/api/{folder1:regex(^\\w{{1,3}}$)}-{folder2:regex(^\\d{{1,9}}$)}"
}
@drlivsi
像这样的事情怎么样: 路径:“/{path:regex(^(v1|beta)$}/bpm/{**path}”
可行吗?
我想支持我的 API 的 v1 和 beta 版本