502 Bad Gateway — Causes & Fix
HTTP 502 (Bad Gateway) means a server acting as a gateway/proxy received an invalid response from the upstream (origin) server it was trying to reach.
- Applies to
- Any website or web server (HTTP standard)
- Time to fix
- 15 minutes – 2 hours
What it means
Causes include the origin server being down or crashing, a bad proxy/load-balancer config, or firewall/timeout issues between proxy and origin. This is a server-side (5xx) error defined in RFC 9110 (HTTP Semantics) — the request was valid, so the fix is on the server/origin side, not the visitor's.
Symptoms
- "502 Bad Gateway"
- Site down behind a proxy/CDN/load balancer
How to fix it
- 1
As a visitor
1. Refresh and wait — it is usually temporary while the server recovers.
- 2
As the operator
1. Check the origin/upstream service is running and healthy. 2. Review proxy/load-balancer config and connectivity to the backend.
Frequently asked questions
What causes 502 Bad Gateway?
A proxy (CDN/load balancer) got a bad or no response from the backend server — often the backend is down, overloaded, or misconfigured.
Last updated July 20, 2026
Guidance only — always consult a qualified professional or the official service manual before carrying out repairs.