I have an instance of home-assistant being server from home..com. Using k8s-at-home helm chart I added a code-server sidecar to be served from home..com/codeserver. Both of these ingresses use ingress-nginx. The codeserver ingress redirects to home assistant root path when using home..com/codeserver, but when using home..com/codeserver/ it properly redirects to the code-server ingress. I would like not to have to explain that the last '/' is necessary. What can I do to make .com/codeserver work?
Here is the codeserver ingress:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: home-assistant-codeserver
namespace: home
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$2
nginx.ingress.kubernetes.io/use-regex: 'true'
spec:
ingressClassName: nginx
tls:
- hosts:
- home.<DOMAIN>.com
secretName: home-tls
rules:
- host: home.<DOMAIN>.com
http:
paths:
- path: /codeserver(/|$)(.*)
pathType: Prefix
backend:
service:
name: home-assistant-codeserver
port:
number: 12321
Here is the home-assistant ingress:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: home-assistant
namespace: home
spec:
ingressClassName: nginx
tls:
- hosts:
- home.<DOMAIN>.com
secretName: home-tls
rules:
- host: home.<DOMAIN>.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: home-assistant
port:
number: 8123
I've been playing around with the nginx.ingress.kubernetes.io/rewrite-target
annotation, but with no luck. What I have above seems to be the best solution from what I've seen online, but I'm still having this issue.