I have different applications running in Kubernetes and I wrote an ingress file to access them using the path.
I have tried removing the annotation nginx.ingress.kubernetes.io/rewrite-target
but then I cannot find the applications anymore
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: farmconnect-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$1
nginx.ingress.kubernetes.io/app-root: /location1/myapp
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/affinity: "cookie"
nginx.ingress.kubernetes.io/session-cookie-name: "route"
nginx.ingress.kubernetes.io/session-cookie-expires: "86400"
nginx.ingress.kubernetes.io/session-cookie-max-age: "86400"
spec:
rules:
- http:
paths:
- path: /?(.*)
backend:
serviceName: location1-service
servicePort: 80
- path: /location1/?(.*)
backend:
serviceName: location1-service
servicePort: 80
- path: /location2/?(.*)
backend:
serviceName: location2-service
servicePort: 80
What I want is to keep my location in the URL like this:
www.mysite.com/location1/myapp
www.mysite.com/location2/myapp
.
.
At the moment it goes like this:
www.mysite.com/myapp
How can I keep the path in my URL?
Thanks