kubernetes / ingress-nginx

Ingress NGINX Controller for Kubernetes
https://kubernetes.github.io/ingress-nginx/
Apache License 2.0
17.46k stars 8.25k forks source link

K8S ingress rule fails to match Exact / #10631

Open saffih opened 12 months ago

saffih commented 12 months ago

Using Pattern to catch Exact /: │app.kubernetes.io/name: rke2-ingress-nginx │app.kubernetes.io/version: 1.6.4 │helm.sh/chart: rke2-ingress-nginx-4.5.201 Having an ingress with: │ rules: │ - http: │ paths: │ - backend: │ service: │ name: powerflex-status-ui │ port: │ number: 80 │ path: / │ pathType: Exact When calling: curl -k -H 'Cache-Control: no-cache, no-store' -I ​https://100.68.80.54/ HTTP/2 404 It should have returned 200 - it fails to match a single / It worked with an older version. We have a workaround, adding $ to the expression.

WORKAROUND: That one seems identical but it works - getting http 200 by using: Exact /$ │ rules: │ - http: │ paths: │ - backend: │ service: │ name: powerflex-status-ui │ port: │ number: 80 │ path: /$ │ pathType: Exact

Expected 200 :

The parsing with Exact is not good - a minor bug and we have a workaround by changing the expression: /$ It should behave the same with \ vs. \$

NGINX Ingress controller version (exec into the pod and run nginx-ingress-controller --version.):


NGINX Ingress controller Release: nginx-1.6.4-hardened4 Build: git-90e1717ce Repository: https://github.com/rancher/ingress-nginx.git nginx version: nginx/1.21.4


Kubernetes version (use kubectl version): 1.26.4+rke2r1

Environment:

NAME="SLES" VERSION="15-SP4" VERSION_ID="15.4" PRETTY_NAME="SUSE Linux Enterprise Server 15 SP4" ID="sles" ID_LIKE="suse" ANSI_COLOR="0;32" CPE_NAME="cpe:/o:suse:sles:15:sp4" DOCUMENTATION_URL="https://documentation.suse.com/"

  • Kernel (e.g. uname -a): Linux sn-451-vm51 5.14.21-150400.24.81-default #1 SMP PREEMPT_DYNAMIC Tue Aug 8 14:10:43 UTC 2023 (90a74a8) x86_64 x86_64 x86_64 GNU/Linux

NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME sn-451-vm51 Ready control-plane,etcd,master 30h v1.26.4+rke2r1 100.68.80.51 SUSE Linux Enterprise Server 15 SP4 5.14.21-150400.24.81-default containerd://1.6.19-k3s1 sn-451-vm52 Ready control-plane,etcd,master 30h v1.26.4+rke2r1 100.68.80.52 SUSE Linux Enterprise Server 15 SP4 5.14.21-150400.24.81-default containerd://1.6.19-k3s1 sn-451-vm53 Ready control-plane,etcd,master 30h v1.26.4+rke2r1 100.68.80.53 SUSE Linux Enterprise Server 15 SP4 5.14.21-150400.24.81-default containerd://1.6.19-k3s1

/label rke2

k8s-ci-robot commented 12 months ago

This issue is currently awaiting triage.

If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
bmv126 commented 12 months ago

Looks like same as https://github.com/kubernetes/ingress-nginx/issues/10618

longwuyuan commented 12 months ago

@saffih is it possible for you to write a test step-by-step instruction that a reader can copy/paste from and reproduce on a minikube/kind cluster

github-actions[bot] commented 10 months ago

This is stale, but we won't close it automatically, just bare in mind the maintainers may be busy with other tasks and will reach your issue ASAP. If you have any question or request to prioritize this, please reach #ingress-nginx-dev on Kubernetes Slack.