<p>I have a service running in a docker container in Kubernetes. It has https/tls hand off by an ingress and then into the container via http. My issue is when the webApp that's running in the container returns a redirect or a request for the resource, it is returning http endpoints not https. </p>

<p>So for example: </p>

<p>Request: <a href="https://my.service" rel="nofollow noreferrer">https://my.service</a> </p>

<p>Returns redirect: <a href="http://my.service/login.html" rel="nofollow noreferrer">http://my.service/login.html</a></p>

<p>Is there any way around this? </p>

<p>Thanks for your help.</p>

<p>I see your application is returning redirects to <code>http</code> and you are trying to rewrite these <code>http</code> to <code>https</code> in responses.</p>

<p>When using <a href="https://kubernetes.github.io/ingress-nginx/" rel="nofollow noreferrer">kubernetes nginx ingress controller</a> adding these two annotations to your ingress object will solve your problem:</p>

<pre><code>nginx.ingress.kubernetes.io/proxy-redirect-from: http
nginx.ingress.kubernetes.io/proxy-redirect-to: https
</code></pre>

<p>More details can be found in <a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#proxy-redirect" rel="nofollow noreferrer">ingress controller annotation descriptions</a> and in <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_redirect" rel="nofollow noreferrer">official nginx documentation</a></p>

<p>Let me know it it helped.</p>
