简体   繁体   中英

Redirects using http instead of https when in k8s with tls hand off by ingress

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.

So for example:

Request: https://my.service

Returns redirect: http://my.service/login.html

Is there any way around this?

Thanks for your help.

I see your application is returning redirects to http and you are trying to rewrite these http to https in responses.

When using kubernetes nginx ingress controller adding these two annotations to your ingress object will solve your problem:

nginx.ingress.kubernetes.io/proxy-redirect-from: http
nginx.ingress.kubernetes.io/proxy-redirect-to: https

More details can be found in ingress controller annotation descriptions and in official nginx documentation

Let me know it it helped.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM