What Does 502 Bad Gateway Mean?#
A 502 Bad Gateway indicates that the edge server (server acting as a proxy) was not able to get a valid or any response from the origin server (also called upstream server). This can occur for a few reasons, which we’ll discuss in the section below. If one of KeyCDN’s edge servers receive a 502 Bad Gateway response from your origin server, KeyCDN will return a 500 Origin Not Reachable page. To get a better understanding on how KeyCDN handles certain error codes, check out our CDN Error Codes page.
How to Solve 502 Errors - for Web Developers#
As a web developer or owner of the website, there are a few reasons why you may be experiencing a 502 Bad Gateway error on your origin server. Therefore, you may need to try various methods to resolve the issue. Reference the list of suggestions below:
Check if your FQDN (fully qualified domain name) is resolving correctly by using our DNS test tool.
Verify if your server is reachable by using a ping test or trace-route.
Check your firewall logs if you are seeing unusual drops.
If you’re a Cloudflare user, try disabling it as once you’ve reached a certain limit Cloudflare will return a 502 Bad Gateway error to your visitors.
How to Solve 502 Errors - for Visitors#
If you’re a website visitor and experience a 502 Bad Gateway error then there is also a few things you can try to resolve it. Although the primary issue will almost always be the responsibility of the web developer, visitors can try the following:
Perform a hard-refresh in your browser. On Macs, this is done by pressing Cmd + Shift + R.
Clear your browser cache and delete cookies. Your browser may be holding on to certain files that were saved once you visited the website with a 502 error.
Restart your computer/networking equipment
Change your DNS servers. If you’ve never changed them in the past you likely still have the default servers assigned to you by your ISP, try using open DNS servers such as Google's Public DNS.