title: Why my AWS Lightsail instance got "Health Check: Failed" when attach to a load balancer?
body: <p>I created an <code>AWS Lightsail instance</code> and a <code>Load Balancer</code> also in <code>AWS Lightsail</code>.
  When I attached my instance to the load balancer, I got this status: <code>Health Check: Failed</code>. I don't know why? I go to my WordPress and everything works fine.</p>
  <p>Updated:
  As I know, the LB only check my instance health on port 80, which is HTTP protocol. I have checked it and it always return <code>HTTP/1.1 301 Moved Permanently</code>. I have already add these in <strong>httpd-prefix.conf</strong>:</p>
  <pre><code>SetEnvIf x-forwarded-proto https HTTPS=on
  
  RewriteEngine On
  RewriteCond %{HTTP:X-Forwarded-Proto} =http
  RewriteRule . https://%{HTTP:Host}%{REQUEST_URI} [L,R=permanent]
  </code></pre>
  <p>And these in <strong>wp-config.php</strong>:</p>
  <pre><code>if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
      $_SERVER['HTTPS']='on';
  </code></pre>
  <p>And these in <strong>bitnami.conf</strong>:</p>
  <pre><code>RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteCond %{HTTP_HOST} !^localhost
    RewriteCond %{HTTP_HOST} !^[0-9]+.[0-9]+.[0-9]+.[0-9]+(:[0-9]+)?$
    RewriteCond %{REQUEST_URI} !^/\.well-known
    RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]
  </code></pre>
  <p>And restart my apache but it still not works.</p>