title: Kubernetes HTTP health check fails with `http: server gave HTTP response to HTTPS client`
body: <p>This occurred after I did a:</p>
  
  <pre><code>    RewriteCond %{HTTP:X-Forwarded-Proto} !https
      RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
  </code></pre>
  
  <p>In apache which in effect does a 301 redirect based on a HTTP header. </p>
  
  <p>Demonstarted with this curl:</p>
  
  <pre><code>curl -vk -H 'Host: example.com' 172.17.0.2/api/v1/ping
  * Expire in 0 ms for 6 (transfer 0x1af6470)
  *   Trying 172.17.0.2...
  * TCP_NODELAY set
  * Expire in 200 ms for 4 (transfer 0x1af6470)
  * Connected to 172.17.0.2 (172.17.0.2) port 80 (#0)
  &gt; GET /api/v1/ping HTTP/1.1
  &gt; Host: example.com
  &gt; User-Agent: curl/7.64.0
  &gt; Accept: */*
  &gt; 
  &lt; HTTP/1.1 301 Moved Permanently
  &lt; Date: Fri, 26 Jul 2019 18:14:09 GMT
  &lt; Server: Apache/2.4.38 (Debian)
  &lt; Location: https://example.com/api/v1/ping
  &lt; Content-Length: 239
  &lt; Content-Type: text/html; charset=iso-8859-1
  &lt; 
  &lt;!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"&gt;
  &lt;html&gt;&lt;head&gt;
  &lt;title&gt;301 Moved Permanently&lt;/title&gt;
  &lt;/head&gt;&lt;body&gt;
  &lt;h1&gt;Moved Permanently&lt;/h1&gt;
  &lt;p&gt;The document has moved &lt;a href="https://example.com/api/v1/ping"&gt;here&lt;/a&gt;.&lt;/p&gt;
  &lt;/body&gt;&lt;/html&gt;
  * Connection #0 to host 172.17.0.2 left intact
  </code></pre>
  
  <p>Why is this pod failing on this error?</p>
  
  <pre><code>  Warning  Unhealthy  99m (x7 over 100m)  kubelet, minikube  Readiness probe failed: Get https://172.17.0.9:80/api/v1/ping: http: server gave HTTP response to HTTPS client
  </code></pre>