kubernetes ingress and https redirect for apache not working

9/30/2016

if i enable redirect in apache from http to https, the ingress health rule wouldn't be able to locate the apache services giving it a "UNHEALTHY" status, this on google cloud.

-- PaulMB
apache
gcloud
kubernetes
kubernetes-health-check

1 Answer

9/30/2016

After days of research this is the best solution i could came up with was adding this in your apache pod

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

where RewriteCond %{REQUEST_URI} ^/myapp is the location for your app remember if u redirect everything, the ingress health rule would get redirected everytime and marking it as "UNHEALTHY", thats why u need to tell apache what to redirect only.

-- PaulMB
Source: StackOverflow