Recently got an issue on k8s. The detail is:
- Login to https://abc.com
- After login, the expected is that the URL will be redirected to https://abc.com/home however, it is wrongly redirected to the internal name of the hostname abc.com, like https://abc-internal.com/home
Initially I thought that this is an easy issue which is caused by the headers is not forwarded from k8s ingress to the service, including the headers of
HostX-Forwarded-ForBut after some logs, these headers are totally correct.
And finally by comparing the request/response dumps inside k8s and outside k8s, we found that this issue is not happening when the k8s ingress process the request; however it happens when ingress process the Response.
When It processes the Response, it REWRITE the 302 Location header from the correct value to the wrong value.
To Fix, just set the correct value for Nginx Ingress Controller, for
1 | metadata: |
And issue fixed.