Redirect from application receiving wrong port from ingress2020-02-14 nginx kubernetes-ingress nginx-ingress
We have an application which will redirect https://hostname.com/test to https://hostname.com/redirected. This works fine without the ingress. When the ingress is added infront, it will instead change the redirect to https://hostname:80/redirected, which obviously is not desireable. SSL is not handled by the ingress itself- traffic comes in to the ingress on port 80 (http).
$ curl -vI https://hostname.com/test1 ... HTTP/1.1 301 Moved Permanently Location: https://hostname.com:80/redirected ...
What I want, is to just stop the ingress from changing anything in the location of redirects. Whatever response is sent from the backend applications, should just be propagated.
The only possible fix we've identified is to use the following annotations, which we would prefer to avoid since it's just an ugly workaround:
nginx.ingress.kubernetes.io/proxy-redirect-from: https://hostname.com:80 nginx.ingress.kubernetes.io/proxy-redirect-to: https://hostname.com
This was tested with nginx-ingress-controller 0.25.1 and 0.28.0
Big thanks for any help.
- Nginx Ingress - how to set redirect to external site if there is no marching route?
- Add DNS entry to local /etc/hosts for traffic redirect to PKS Ingress controller
- Nginx Ingress service call initiated in the backend service not redirect to https
- Set limit_req for specific location in Nginx Ingress
- Kubernetes Nginx Ingress HTTP to HTTPS redirect via 301 instead of 308?
- Redirection from http to https not working for custom backend service in Kubernetes Nginx Ingress Controller
- Nginx Ingress Selective Reverse Proxy Location Rewrite
- Ingress backend rule by port?
- Implementing workaround for missing http->https redirection in ingress-gce with GLBC
- Can I redirect non-SSL traffic that comes in on an SSL port with Nginx