Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compute Engine HTTP Load Balancing 502 error

Tags:

We're having significant issues with our http load balancer from certain IPs only.

I've seen a few other posts here about this. We've made sure the firewall is ok, I've even deleted and recreated the forwarding rules. Which is blasted annoying since the IP changes.

Still no joy. The problem only affects certain IP addresses - and if I post the same data to the IP of one of the servers, I have no problem.

<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>502 Server Error</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Server Error</h1>
<h2>The server encountered a temporary error and could not complete your request.<p>Please try again in 30 seconds.</h2>
<h2></h2>
</body></html>

EDIT

We use cloudflare - usually this is actually disabled for this host however, I have just re-enabled it and now traffic is accepted again. Presumably since the traffic originates from a CF ip.

like image 498
simonmorley Avatar asked Sep 13 '15 17:09

simonmorley


1 Answers

A 502 error is a "bad gateway" response. Have you checked the health check status of your instances at the time that the 502 errors are occurring?

You haven't mentioned whether you're running backends in more than one region. It's possible that your backends in one region are all being marked unhealthy at once, which is causing your failures.

Are your backend services using the default HTTP health check, or have you customized it? If the former, you might consider defining a more lenient health check for your backends (though this may mask actual application server failures). The default is to check backends every 5s on "/" with a 5s timeout, and require 2 consecutive failures or successes to change the state.

like image 127
E. Anderson Avatar answered Sep 19 '22 00:09

E. Anderson