kubernetes ingress 和 https redirect for apache 不工作

kubernetes ingress and https redirect for apache not working

如果我在 apache 中启用从 http 到 https 的重定向, 入口健康规则 将无法定位 apache 服务,使其处于 "UNHEALTHY" 状态,这在 google 云上。

经过几天的研究,这是我能想出的最好的解决方案,就是将它添加到您的 Apache Pod 中

RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{REQUEST_URI} ^/myapp
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

其中 RewriteCond %{REQUEST_URI} ^/myapp 是您的应用的位置 请记住,如果你重定向所有内容,入口健康规则 每次都会被重定向并将其标记为 "UNHEALTHY",这就是为什么你需要告诉 apache 只重定向什么。