title: gcp http-health-check fails when forcing redirecting to `www.`
body: <p>I'm using GCP, &amp; I want to force redirecting all my site's traffic from <code>example.com</code> to <code>www.example.com</code>, so I'm using a simple redirect in my Nginx configuration like:</p>
  
  <pre><code>server {
      listen      80;
      server_name example.com;
      return      301         https://www.example.com$request_uri;
  }
  server {
      listen      80;
      server_name www.example.com;
      if ($http_x_forwarded_proto = "http") {
          return 301 https://$host$request_uri; #permanent;
      }
      #Other configurations
  }
  </code></pre>
  
  <p>(this Nginx configuration is inside my instances in a loadbalancer's backend service, where the loadbalancer's frontend has the ssl certificate)</p>
  
  <p>But now GCP's default http-health-check is not working because it is waiting for a <code>200</code> response, not the <code>301</code> I'm responding with,</p>
  
  <p>So, how to make the <code>www.</code> redirect with using the http-health-check?</p>