Forum Discussion
How to rewrite a path to a backend service dropping the prefix and passing the remaining path?
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
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