Back to all articles
Website MonitoringHTTP ErrorsNetworking

HTTP 502 Bad Gateway: Causes, Checks and Monitoring

Understand HTTP 502 Bad Gateway errors, what they usually indicate, and how to monitor upstream failures without relying on manual refreshes.

By PingStag Engineering5 min read

Quick answer

Understand HTTP 502 Bad Gateway errors, what they usually indicate, and how to monitor upstream failures without relying on manual refreshes.

What is a 502 Bad Gateway?

A 502 response usually appears when a gateway or proxy receives an invalid response from an upstream service. In modern stacks that can mean a reverse proxy, load balancer, CDN, or gateway could not get a usable response from the application behind it.

Why 502 errors are tricky

The front door may still be reachable while an upstream application is failing. That makes a basic “can I resolve the domain?” check too shallow. You need a monitor that sees the HTTP response returned by the layer your customers use.

What to monitor

Track the HTTP status, response latency, and whether the error repeats. If your gateway sometimes returns 502 while the backend is recovering, the monitoring history can show whether the incident is isolated or part of a larger degradation pattern.

Do not misclassify security responses

WAFs and security layers can also return non-2xx responses. PingStag's engine includes logic for recognizing certain WAF-generated 403 responses so a blocked monitoring request is not automatically treated as a complete application outage.

Fix the root cause separately

Monitoring tells you that the user-facing path is failing. Your logs and application telemetry are still responsible for identifying the exact upstream defect. The best monitoring workflow connects the alert timestamp to the systems you use for diagnosis.

Sources and references

Related PingStag guides

PingStag

About PingStag Engineering

PingStag is an infrastructure monitoring platform for websites, APIs, TCP services, background jobs, alerting, and status pages. Our guides are based on the monitoring features and workflows documented on this site.

Deploy smarter monitoring in 60 seconds.

Monitor a website, API, TCP port, or background job from one workspace. Start with the free plan.

Start Free Today