One of the potential errors you might see when surfing online websites is a 502 bad gateway. You don’t know what exactly happened or why. All you know is that something’s wrong and you need to fix it.
If you’re searching for ways to overcome a 502 error, you’ve landed in the right place. In this post, we’ll show:
- What is a 502 Bad Gateway Error?
- Common Signs of 502 Bad Gateway Error
- How to Fix a 502 Bad Gateway Error
Want to figure out how to get rid of this 502 bad gateway error? Keep on reading!
What is a 502 Bad Gateway Error?
502 Bad Gateway is an HTTP status code, which are server errors. These errors are no fault of the visitor but suggest that there’s something wrong with the server-side of things. The request the client made is good, but the server cannot generate the requested resource.
Typically, when you visit a website, your access request will be sent to a web server. If this server receives an invalid response from an upstream server, you’ll get a 502 bad gateway message.
Although the 502 error is not as common as a 500 internal server error or a 503 service unavailable error, it still causes interruptions in access. This results in a bad user experience for your site.
Common Signs of 502 Bad Gateway Error
This 502 bad gateway message can be seen in many different ways depending on your browsers and web servers.
Now, we’ll cover you with some common occurrences of this 502 error. They hence help you recognize and find a suitable solution in case you’re stuck in the 502 bad gateway.
Following are various variations of this 502 error on the site:
- “502 Bad Gateway”
- “Error 502”
- “HTTP Error 502 – Bad Gateway”
- “502 Service Temporarily Overloaded”
- “502 Proxy Error”
- A blank white screen
- “502 Server Error: The server encountered a temporary error and could not complete your request”
- “HTTP 502”
- Temporary Error (502)
- 502. That’s an error
- 502 bad gateway Cloudflare
- Bad Gateway: The proxy server received an invalid response from an upstream server
6 Best Methods to Fix a 502 Bad Gateway Error
#1 Reload the Website
The common cause of this 502 bad gateway error is due to temporary network congestion. So, the easiest way to fix this error is to reload the web page a few times.
To solve this issue quickly, you need to refresh the URL code by simply pressing the F5 key or Ctrl+R (Command+R on a Mac) on the keyboard, or clicking the Refresh/Reload button on the browsers.
#2 Try Another Browser
There might be times when your web browser fails to connect to the web server. The ideal solution for this scenario is to use other different browsers or run the incognito mode to access the website.
#3 Clear Your Browser’s Cache
What if you’ve tried both mentioned ways but the issue remains unresolved?
Well. It might be something to do with the caching issue. It makes your browser temporarily unable to update even when the 502 error has been fixed. You should clear your browser’s cache and see if it works before trying the more complicated methods below.
#4 Change the DNS Servers
Sometimes, a DNS issue might cause the 502 Bad Gateway error. That means the domain doesn’t resolve to the correct IP.
By default, the DNS server is assigned automatically by your ISP. You can temporarily change your DNS server yourself to a public DNS, such as Google or Cloudflare to tackle this problem.
#5 Check Your Plugins and Extensions
The incompatible plugins and extensions can also be the cause of the 502 bad gateway error. If that’s the case, you might need to deactivate all plugins and extensions from the WordPress admin area.
If the website works promptly after all plugins are deactivated, it means that one of the plugins causes the 502 error. It’s time to disable your plugins and extensions one by one to find out the incompatible ones.
#6 Check Web Server Error Logs
Another reason for a 502 bad gateway error refers to an issue with the website update. So you need to open the error log to find more clues. In WordPress, you can enable error logging by adding the following line in the wp-config.php file:
define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false );
All error entries will appear in the wp-contents/debug.log file. You can download, view or edit this file. This file contains all the errors, warnings, and notes of WordPress.
There are always chances that you encounter a 502 bad gateway error whether you like it or not. You’d better understand the definition of this error, monitor these common signs, and go about fixing them.
We’ve walked you through 6 solutions for fixing a 502 bad gateway. All of them are useful to help you fix this error effectively and quickly.
Have any other tips or questions regarding the 502 bad gateway message?
Let us know below in the comments.