15

I've configured a HTTP(S) Load balancer as per the documentation on https://cloud.google.com/compute/docs/load-balancing/http/

When I try to access the site via the Public IP address associated with the Load balancer. I'm getting a 502 response with the message:

Error: Server Error

The server encountered a temporary error and could not complete your request.

Please try again in 30 seconds.

I believe this is coming from the load balancer.

Anyone have any insight into what might be going on, what more I should be looking at?

Sunil kumar
  • 215
  • 1
  • 2
  • 7

3 Answers3

5

Have a look at the documentation Troubleshooting HTTP(S) Load Balancing section Unexplained 502 errors:

If 502 errors persist longer than a few minutes after you complete the load balancer configuration, it's likely that either:

To verify that health check traffic reaches your backend VMs, enable health check logging and search for successful log entries.

To create an ingress rule that allows traffic from the Google Cloud health checking systems (130.211.0.0/22 and 35.191.0.0/16) you can use Cloud Console or this command:

gcloud compute firewall-rules create fw-allow-health-check \
    --network=default \
    --action=allow \
    --direction=ingress \
    --source-ranges=130.211.0.0/22,35.191.0.0/16 \
    --target-tags=allow-health-check \
    --rules=tcp

In this command target tag allow-health-check used to identify VMs.

Serhii Rohoza
  • 4,287
  • 2
  • 16
  • 29
3

I had the same problem. After a day of searching, it was a health checker problem. The health test was on TCP, I changed it to HTTP, the problem was solved.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Mehrdad
  • 51
  • 1
  • 5
0

Could it be that the load balancer depends on you using the URL and not an IP address?

There are a couple of reasons that might be the case.

  1. The URL points to the load balancer and the load balancer has a list of server IP addresses that service that URL; then it picks a server and forwards the request. To do that, it must receive the oritinal URL because the load balancer may be serving multiple sets of servers.
  2. If the IP address points to the load balancer, it won't know which set of servers to choose from. If the IP address points to a server, the load balancer will be bypassed.

That's as much as I can think of... Jam

Jim Kay
  • 91
  • 6