What is a gateway?
A modern website is often more than one server. A CDN, reverse proxy, load balancer or API gateway may sit in front of the application. If that intermediary cannot obtain a usable response from the origin, it may send a 502 to the visitor. A 502 therefore often indicates a problem between two server layers, not between your browser and the internet.
What can a visitor do?
- Refresh once and give it a minute or two. A short interruption between services is a common cause.
- Check other websites. If they work normally, 502 is usually not a general issue with your connection.
- If the service has a public status page, look for a reported incident.
- Another network or private window can help diagnose a particular proxy, VPN or cache, but neither is a universal fix.
How is 502 different from related errors?
502 means an intermediary received an invalid upstream response. 503 usually indicates that the service is temporarily unavailable, often because of overload or maintenance. 504 means a gateway did not receive a response in time. Their underlying causes may overlap, but the codes indicate where to begin troubleshooting.
What should a website owner check?
- Origin: are the application and web server running and listening on the expected port?
- Proxy → origin connection: does the firewall, security group or private network allow the traffic?
- TLS: when the proxy uses HTTPS to the origin, do the hostname, certificate and protocol match?
- Timeouts and capacity: does the application respond in time, or have workers, connections or memory run out?
- Most recent deployment: compare the start of 502 errors with a release or DNS, certificate or proxy-rule change.
- Logs from both layers: inspect the proxy/CDN and the origin, not just one side of the chain.
A typical request chain
A visitor opens example.com; the CDN receives the request and forwards it to the origin. If the origin process no longer listens on port 443 or responds with invalid TLS, the CDN may return 502 even though the CDN itself remains reachable.
What is not a good first step?
Clearing all cookies, switching DNS resolvers or reinstalling the browser generally will not fix a server-to-server 502. Those steps make sense only if you have specific evidence of a local proxy, VPN or incorrect DNS route.
Frequently asked questions
Is 502 always temporary?
Often, but not always. A misconfiguration can cause persistent 502 responses.
Will clearing the cache help?
Rarely when the fault is between servers. Refreshing can help with a brief interruption.
Can a CDN return 502?
Yes. It can return 502 when it cannot reach the origin or receives an invalid response.
Can a certificate issue cause 502?
Yes, especially if a reverse proxy uses HTTPS to the origin and the TLS settings between them are incorrect.