Forum Discussion
How to rewrite a path to a backend service dropping the prefix and passing the remaining path?
So, I started from scratch at Digital Ocean... I created two Kubernetes clusters using their default configuration:
* aboh-cluster is the community version of nginx ingnress
* abitofhelp-cluster is the commercial version of nginix ingress
Nginx community: helm 4.1.3, ingress-nginx 1.21, nginx 1.19.10
Nginx commercial: helm 2.2.2, ingress 1.22
Unfortunately, the outcome is the same as in my previous test. The community version works with the deployment/service and ingress manifests. The commercial version with 404 errors using the same manifests and curl commands.
I have captured the following in the attached compressed file:
* Descriptions of the services and ingresses;
* Manifests for the deployments, services, and ingresses;
* Logs capturing the curl command and the result
I am not sure where to go from here... We want to use the commercial version with support, but cannot seem to get it to work.
Thanks for any hints or help,
Mike
- BrianEhlertJun 06, 2022Employee
Hey Michael
The first thing that I will mention is that annotations are unique to each implementation.
The annotations specific to the community ingress controller are not implemented by other projects. This is probably the first hurdle you are hitting.
This block here:nginx.ingress.kubernetes.io
Defines that your annotation is specific to the community project.
Rewrites for the NGINX Inc ingress controller project have an example here for the Ingress object: https://github.com/nginxinc/kubernetes-ingress/tree/main/examples/rewrites
And an example here using the project specific CRDs: https://github.com/nginxinc/kubernetes-ingress/tree/main/examples/custom-resources/rewrites
- JSON-Williams_NGIИXJun 06, 2022Employee
Rob_Michel As BrianEhlert mentioned, you need to change your annotation and Ingress resource slightly to match the commercial version of NGINX Ingress controller.
You can try something like this:
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: cafe-ingress annotations: nginx.org/rewrites: "serviceName=httpbin-service rewrite=/" spec: rules: - host: cat.abitofhelp.io http: paths: - path: /httpbin/ pathType: Prefix backend: service: name: httpbin-service port: number: 8999
Make sure you adjust accordingly to match your environment.
- michaelgardnerJun 08, 2022Altocumulus
Hi Guys,
Thank you very much for your detailed responses! I am traveling today but will make the changes when I get to the office and will report back. If things go well, I will put together a simple demo that implements current best practices for gateway security and routes gRPC and HTTP->HTTPS traffic. I will use it for a presentation to Management and will post it here and in a few other locations to help others kick-start a demo.
We are currently using Emissary Ingress and are tired of wrangling poor documentation, bugs, and lack of quality community/support. My hope is to get the green light to migrate to nginx.com.
I will report back and want to thank you for your help!
Mike
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com