-
Notifications
You must be signed in to change notification settings - Fork 340
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
request help: how to use wildcards in paths with ApisixRoute CRD #1927
Comments
Good catch! I think we can change the rules. |
|
I hit the same issue. |
As a workaround, you can use regular expression matching. For example: apiVersion: apisix.apache.org/v2
kind: ApisixRoute
metadata:
name: speaker-topics-route
spec:
http:
- name: speaker-topics
match:
hosts:
- conferenceapi.azurewebsites.net
paths:
- /*
exprs:
- subject:
scope: Path
name: topics
op: RegexMatch
value: "^/speaker/[^/]*/topics$"
methods:
- "GET"
upstreams:
- name: conference-api-upstream See navendu.me/posts/batching-requests for full explanation. Should we still change the rule or continue with this workaround? |
This workaround works if there is only one ApiSixRoute with http[0].match.paths = /* |
FYI @byblakeorriver I just tested it using apisix helm chart version |
Thank you! It looks like it is working for me now too! |
Issue description
Hi, I have some APIs paths like:
/api/:id/my-entity1
/api/:id/my-entity2
I could not use the CRD ApisixRoute because it has a validation for this field that the wildcard must be at the end.
spec.http[0].match.paths[0] in body should match '^/[a-zA-Z0-9\-._~%!$&'()+,;=:@/]*\*?$'
But if I use the admin api directly (our by the dashboard), I'm able to use a wildcard at path like:
{ "uris": [ "/api/*/my-entity1", "/api/*/my-entity2" ], "name": "route, "priority": 0, "methods": [ "GET" ], "upstream_id": "2fa86803" "status": 1 }
Is there anyway to do this with CRDs?
Environment
The text was updated successfully, but these errors were encountered: