[英]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.我有一个在 Kubernetes 的 docker 容器中运行的服务。 It has https/tls hand off by an ingress and then into the container via http.
它通过入口将 https/tls 移交,然后通过 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.
我的问题是当容器中运行的 webApp 返回重定向或资源请求时,它返回的是 http 端点而不是 https。
So for example:例如:
Request: https://my.service请求: https://my.service
Returns redirect: http://my.service/login.html返回重定向: 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.我看到您的应用程序正在将重定向返回到
http
而您正试图在响应中将这些http
重写为https
。
When using kubernetes nginx ingress controller adding these two annotations to your ingress object will solve your problem:使用kubernetes nginx 入口控制器时,将这两个注释添加到入口对象将解决您的问题:
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更多细节可以在入口控制器注释描述和官方 nginx 文档中找到
Let me know it it helped.让我知道它有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.