在 k8s 中使用 http 而不是 https 重定向,通过入口进行 tls 切换
Redirects using http instead of https when in k8s with tls hand off by ingress
我在 Kubernetes 的 docker 容器中有一个服务 运行。它通过入口 https/tls 切换,然后通过 http 进入容器。我的问题是,当容器 returns 中 运行 的 webApp 重定向或资源请求时,它返回的是 http 端点而不是 https。
例如:
Returns 重定向:http://my.service/login.html
有什么办法解决这个问题吗?
感谢您的帮助。
我看到您的应用程序正在返回指向 http
的重定向,而您正试图在响应中将这些 http
重写为 https
。
使用 kubernetes nginx ingress controller 时,将这两个注释添加到您的入口对象将解决您的问题:
nginx.ingress.kubernetes.io/proxy-redirect-from: http
nginx.ingress.kubernetes.io/proxy-redirect-to: https
可以在 ingress controller annotation descriptions and in official nginx documentation
中找到更多详细信息
告诉我它有帮助。
我在 Kubernetes 的 docker 容器中有一个服务 运行。它通过入口 https/tls 切换,然后通过 http 进入容器。我的问题是,当容器 returns 中 运行 的 webApp 重定向或资源请求时,它返回的是 http 端点而不是 https。
例如:
Returns 重定向:http://my.service/login.html
有什么办法解决这个问题吗?
感谢您的帮助。
我看到您的应用程序正在返回指向 http
的重定向,而您正试图在响应中将这些 http
重写为 https
。
使用 kubernetes nginx ingress controller 时,将这两个注释添加到您的入口对象将解决您的问题:
nginx.ingress.kubernetes.io/proxy-redirect-from: http
nginx.ingress.kubernetes.io/proxy-redirect-to: https
可以在 ingress controller annotation descriptions and in official nginx documentation
中找到更多详细信息告诉我它有帮助。