A 502 Bad Gateway Error is one of the common errors you may site on your website. This indicates that the edge server could not receive responses from the origin servers. There are many reasons for this error to occur depending on your server and the error message also varies accordingly. When a request is raised from the user, the same request is sent to the hosting server by the browser, and intern the hosting server finds the result and sends back the request with the status code. We cannot see these status codes normally until there is an error. In this post, let us discuss the possible ways of its occurrence and how to fix the 502 Bad Gateway Error in WordPress.
Reasons for 502 Bad Gateway Errors
There are many reasons that trigger a 502 Bad Gateway response. And these are the most common reasons for the occurrence of the 502 Bad Gateway Error in WordPress.
Domain name not resolvable: If the domain is not resolving to the corresponding IP address or to any IP address, the error occurs. If you have made any DNS changes to your site then it could take some time to fully propagate and get active globally. This totally depends on the TTL (time to live). Check out our guide on how to choose a domain name for your WordPress website.
Hosting server down: If the origin server is not reachable, then most probably the 502 error arises. It may be either down or there is no connectivity established. Contact your hosting provider to resolve.
Firewall/Security blocks: A security firewall might block the connection between the edge servers and the origin server due to security reasons. The security plugin on your CMS can also interrupt the connection. and also some DDoS protection is overreactive to block incoming requests.
Possible 502 Bad Gateway Errors
These are the possible ways that you could see a 502 bad gateway error. Although they all mean the same thing, only the names differ.
- 502 Bad Gateway
- HTTP Error 502 – Bad Gateway
- 502 Service Temporarily Overloaded
- Error 502
- 502 Proxy Error
- HTTP 502
- 502 Bad Gateway NGINX
How to Fix 502 Bad Gateway Error in WordPress – For Developers
There may be several reasons for the 502 error to occur as mentioned above. And as a web developer or owner of the website look into the following methods to try getting rid of the error.
- Try out ping test to check if your server is reachable
- Check if your fully qualified domain name is resolving correctly.
- Check firewall logs on unusual drops.
- Disable CDN or firewall temporarily to see if the servers are acting up.
- Keep the WordPress themes and WordPress plugins up to date.
- Contact your hosting provider’s support for any server misconfiguration.
How to Fix 502 Bad Gateway Error in WordPress – For Visitors
If you are a visitor and experience a 502 bad gateway error, you can’t do anything much about this, but still, you can try out some steps to make things work.
- Perform a hard refresh in your browser. On Windows hold down CTRL and click the Reload button or, hold down CTRL and press F5. On a Mac, press CMD + Shift + R.
- Clear your browser cache and delete cookies. Your browser may be holding on to files that were saved once you visited the website with a 502 error.
- Try restarting your network adapter.
- Change your DNS servers. Even if you’ve never changed them in the recent past, still you may have the default servers assigned to you by your ISP. Use open DNS servers such as Google’s Public DNS to resolve this.
Hope this article helped you out in fixing the 502 Bad Gateway Error in your WordPress website. Comment below if you have any further queries.