When you receive 502 Bad Gateway error in your browser, it means that the server which is acting as a gateway to facilitate taking your request to the server and bring a response back has received an invalid or no response at all. So either the connection is broken, or there is an issue on the server side that returns an invalid response. Although this is a server-level error, there are a few things you could try at your end and see if it helps, if simply pressing Ctrl+F5 does not help.
Fix 502 Bad Gateway error
This error can show up on any website. I am sure you have seen site hosted on Cloudflare, Twitter Overcapacity error, Bad Gateway NGINX, and even when Windows Update fails due to 502 error, it displays WU_E_PT_HTTP_STATUS_BAD_GATEWAY message.
Apart from the Bad Gateway error, you may also errors like-
- Error 502
- Temporary Error (502)
- 502 Proxy Error
- 502 Server Error: The server encountered a temporary error and could not complete your request
- HTTP 502
- Bad Gateway: The proxy server received an invalid response from an upstream server
End user Resolution
1] Flush DNS, reset Winsock and reset TCP/IP
You can also use our freeware FixWin to carry out these three operations with a click. You will find the fixes under the Internet & Connectivity tab.
2] Change the DNS
Try changing your DNS to a public DNS like Google Public DNS, Open DNS, Yandex DNS, Comodo Secure DNS or any other and see. DNS Jumper & QuickSetDNS are free tools that will help you change your default DNS settings with a click.
3] Check your Network Cables, Restart Your Router and Reconnect
Ensure that your cables are connected properly either to your PC or your router. If you use a WiFi connection, make sure to restart your router once. Lastly, you can always forget previously connected WiFi and then reconnect.
Server Side Resolution
If you are running a website and seeing these errors, here is what you can try to fix this error.
1] Set Lower TTL: If you have changed server or the IP address of your website, wait for DNS servers to grab the new IP. The propagation takes time. However, you can speed this up by changing the TTL or Time to Live set to a lower number. This will make sure that DNS servers grab the new IP address comparatively faster.
2] Check if your Server is Stable: You need to make sure that your server is not randomly going down or no connectivity to the server is having an issue. You may need to ask your Host to resolve this.
3] Security Plugin on Server: Many CMS or Hosting use security software to mitigate DDOS protection. If those plugins are not configured properly, they might overreach and start blocking user requests to access the website.
4] Are you using CloudFare like services? While services like CloudFare are free for basic usage, they start dropping requests once you’ve reached a certain limit CloudFlare will return a 502 Bad Gateway error to your visitors. If you are using anything similar, make sure to check on error logs or notifications from these services.
Let us know if any of these tips helped you to resolve the 502 Bad Gateway error.