You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "mchtech (via GitHub)" <gi...@apache.org> on 2023/04/12 12:13:00 UTC

[GitHub] [apisix] mchtech opened a new issue, #9296: bug: regex path route matching is unstable

mchtech opened a new issue, #9296:
URL: https://github.com/apache/apisix/issues/9296

   ### Current Behavior
   
   regex path ingress rules are ordered by create time
   
   ### Expected Behavior
   
   regex path ingress rules are ordered by path length (or alphabetical order?) :[ingress-nginx:   first orders the paths by descending length](https://kubernetes.github.io/ingress-nginx/user-guide/ingress-path-matching/#path-priority)
   
   
   
   ### Error Logs
   
   _No response_
   
   ### Steps to Reproduce
   
   1. config-A:
   ```yaml
   apiVersion: networking.k8s.io/v1
   kind: Ingress
   metadata:
     annotations:
       k8s.apisix.apache.org/use-regex: "true"
     name: ingress-a
     namespace: default
   spec:
     ingressClassName: apisix
     rules:
     - http:
         paths:
         - backend:
             service:
               name: svc-a
               port:
                 name: http
           path: /api/.*   # <---- override ingress-b, but ingress-b is more 'accurate'
           pathType: ImplementationSpecific
   ```
   2. config-B:
   ```yaml
   apiVersion: networking.k8s.io/v1
   kind: Ingress
   metadata:
     annotations:
       k8s.apisix.apache.org/use-regex: "true"
     name: ingress-b
     namespace: default
   spec:
     ingressClassName: apisix
     rules:
     - http:
         paths:
         - backend:
             service:
               name: svc-b
               port:
                 name: http
           path: /api/bbb/.*
           pathType: ImplementationSpecific
   ```
   3. if first create `ingress-b` (then create `ingress-a`), apisix works as expect
   4. if first create `ingress-a` (then create `ingress-b`), `/api/bbb/ccc` will still route to `svc-a` (should be `svc-b`)
   
   
   ### Environment
   
   - APISIX version (run `apisix version`): 3.2.0
   - Operating system (run `uname -a`): oracle linux 8.6 kernel 5.6.11
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`): nginx version: openresty/1.21.4.1
   - etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`): 3.5.4
   - APISIX Dashboard version, if relevant: 0.8.0
   - Plugin runner version, for issues related to plugin runners: -
   - LuaRocks version, for installation issues (run `luarocks --version`): -
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org