I am trying to create an ingress to acces the rabbitMQ management dashboard. This is what I have so far:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: rabbitmq-ingress
namespace: rabbimq
annotations:
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
ingressClassName: nginx
rules:
- host: "myhost.com"
http:
paths:
- backend:
service:
name: rabbitmq
port:
number: 15672
path: "/rabbit(/|$)(.*)"
pathType: Prefix
With this ingress I can acces to the dashboard but not completly. RabbitMq can create this kind of URL: myhost.com/rabbit/#/queues /%2F/ my-queue
The %2F being the encoding of the default rabbitmq vhost. But NGINX seems to decode the vhost and since is a slash the URL look like this: myhost.com/rabbit/#/queues /// my-queue
Nginx will compress the 3 adjacent slashes into a single slash since it is the default behaviour.
Which leads to my question: How can I disable the merge of the slashes on an nginx controller ?
I know there is the merge_slashes
that i need to set to off, but i can't figure how to do.
I tried adding this:
nginx.ingress.kubernetes.io/configuration-snippets: |
merge_slashes off;
In rabbitmq-ingress file but got this error from the nginx controller logs : "merge_slashes" directive is not allowed here in /etc/nginx/nginx.conf
I tried with this instead:
nginx.ingress.kubernetes.io/server-snippets: |
merge_slashes off;
I don't have any error but it still didn't resolve the issue.
How can I do ?