kubernetes-ingress
kubernetes-ingress copied to clipboard
Support for ingress.kubernetes.io/app-root
I would like to create an annotation that returns 302 redirect to specified path when the root path is visited. The application will not work if rewrite is used for the backend. The end user browser needs to be redirected to specified path.
I do not wish to use rewrite to the backend. The annotation "haproxy.org/path-rewrite: / /foo" is not doing what I need.
Desired example yaml:
kind: Ingress
metadata:
annotations:
ingress.kubernetes.io/app-root: /foo
name: example
spec:
ingressClassName: haproxy
rules:
- host: example.com
http:
paths:
- backend:
service:
name: example
port:
number: 8080
path: /
pathType: Prefix
Wen visiting / haproxy should return 302 to /foo. Is there a workaround to achieve this? I know a possible workaround is for the container itself to issue a redirect, but it does not currently and it's not the desired solution.
Other ingress controllers seem to support it: https://haproxy-ingress.github.io/docs/configuration/keys/#app-root https://kubernetes.github.io/ingress-nginx/examples/rewrite/#deployment
The why: https://stackoverflow.com/questions/56349008/when-i-would-use-the-app-root-annotation-in-kubernetes