regretoverflow
regretoverflow

Reputation: 2153

Google Compute Engine load balancer health checks on port 443 or 80 with 301

I have an app on 2 Google Compute Engine VMs, and I'm trying to configure a Load Balancer health check. Each server has nginx as a front end proxy that also handles SSL duties for my app. I have nginx configured to redirect port 80 to port 443 via a 301 redirect. On port 443, nginx proxies that traffic to a high port that my app is listening on. I'm trying to configure load balancer health checks, but can't ever get the health check to show healthy. My app has a default root document so requesting http://myapp.com should do a 301 to https://myapp.com, which should return HTTP 200. I configured a health check to test 80 and 443, and both never show healthy, although the load balancer IS sending traffic to them, based on my tests with curl. Based on my above config, the best health check scenario is to request https://myapp.com since that will test the server itself, nginx, and my app serving data.

How can I configure the load balancer to properly test my instances health?

Upvotes: 0

Views: 788

Answers (2)

Riccardo
Riccardo

Reputation: 1237

Is it possible that you were affected by this outage (now solved)?

If not, please disregard this.

Upvotes: 1

Ali
Ali

Reputation: 566

The health check failing indicates that the redirect connection isn't closing properly. This can be confirmed if a tcpdump shows [R] flags, which are interpreted as failures. You'll need to configure nginx to close the connection properly when doing a redirect.

Upvotes: 0

Related Questions