502 Bad Gateway Error: What It Is and How to Fix It
Experiencing a 502 Bad Gateway error? Don’t brush it off too quickly. While a simple refresh often resolves a one-off, recurring errors might signal deeper issues.
If left unattended, these can snowball into significant challenges: Dwindling traffic, poor user experience, and elevated security risks, to name a few.
It’s important to root out the cause of the issue as soon as possible, whether it’s WordPress errors or something else.
The bad news: A variety of potential server-side issues could be throwing the error. The good news is that those error codes you see? They’re your map to effective troubleshooting.
We’ll explain in simple terms what the 502 Bad Gateway error is, why it happens, and most importantly, how to make it disappear.
Let’s get started.
What Is The 502 Bad Gateway Error?
What causes the 502 bad gateway error, how do you fix the 502 bad gateway error (9 possible solutions), solve the 502 bad gateway error.
First of all, a little bit of a crash course on what’s going on behind the scenes may help everything make a bit more sense. After all, knowledge is power, right?
Every time you enter a URL into an address bar and attempt to access a site, your browser sends a request to that site’s server. The server processes that request and then displays the website’s content.
A server is a computer that stores data. A web server is a type of server that stores and delivers web pages to users. Web servers are connected to the internet and use HTTP to send web pages to users who request them.
If something were to go wrong, you would instead see an HTTP status code . Then the fun begins.
You’ve probably faced a 404 error (page not found) at least once, if not a hundred times. It’s saying the server was able to process the request, but couldn’t locate the specific page or content.
In contrast, a 502 Bad Gateway error happens when there’s a communication breakdown between two servers. The first server relayed the message but received an invalid response from the upstream (or next) server.
In other words, the server, which acts as a gateway or proxy, received an invalid response from an inbound server and was not able to fulfill the request.
Depending on the browser you use, the status may appear in a handful of different ways:
- 502 Bad Gateway
- 502 Proxy Error
- HTTP Error 502 – Bad Gateway
- Temporary Error (502)
- 502 Service Temporarily Overloaded
The HTTP 502 server error isn’t limited to a problem with a proxy server or server overload, so let’s dig in a little further and look at some common causes.
Several issues can return a 502 Bad Gateway error. These include:
- An unresolved domain name – There could be connectivity issues between the domain name and your IP address. This often happens when a website recently migrated from one web host to a new hosting provider, and the DNS server hasn’t had time to propagate.
- An oversensitive firewall – If your website (perhaps a WordPress site with a firewall plugin) or your web host has firewall settings that are too restrictive, some Internet providers or IP addresses may be blocked. This can happen when the firewall detects them as a false threat.
- Server overload – A sudden spike in traffic can cause the origin server to crash. If your website’s server is on a shared hosting plan , your traffic can be impacted by everybody else’s traffic (like your neighbors are having a big party, and their guests are taking up all the parking spots.)
Having said the above, it should be noted that the 502 Bad Gateway error isn’t restricted to problems with the server. Client-side issues such as outdated browsers or corrupted files in the browser cache can also be a cause of the status error.
Now, let’s look at how to fix the 502 Bad Gateway error! We’ll cover two scenarios: an issue on the client side and a problem with the server.
1. Refresh The Webpage And Try A Different Browser
We should always start with the simplest solution. The 502 Bad Gateway error could be a temporary issue. For example, the web server may have become overloaded for a few minutes or experienced a brief surge in traffic.
Try waiting a few minutes and refresh the page. If that doesn’t work, you can try accessing the same site using a different browser. If that works, then the issue may be with the original browser. If the page still doesn’t open, the website itself may be the problem.
Another way to determine whether the problem is on your end or at the web server is to use a tool like Down for Everyone or Just Me , or Is It Down Right Now to confirm whether the problem is on your end or with the site’s host.
Using one of these tools will identify the status of your site. If your site isn’t down for everyone, you’ll need to troubleshoot on your end, and the first several steps below will help with that. If your site is down for everyone, you’ll need to check into your site’s backend to find the source of the problem, which will be addressed later in the post.
2. Test Using Another Device
Assuming you’ve been using your computer and ISP, try to access your website from your cell phone. First, go to your phone’s settings and turn off your wifi, then make sure your mobile data is enabled. If you’re able to access your site, the problem is at your end, and rebooting your network may fix the issue.
To reboot your network, shut your computer down, then unplug your modem and router. If you have an integrated modem and wifi router, unplug it, wait for about a minute, then plug in your modem and let it reboot. Then plug in your router and let it boot up. If you have integrated hardware, plug it in and let it boot.
Finally, start your computer and try to access your site.
3. Clear Your Browser’s Cache
Browsers store a lot of data, primarily to help pages load faster the next time they’re opened. However, your browser cache may contain outdated site data or corrupted files, leading to the Bad Gateway error.
Based on this, the next thing to do is clear your browser cache . Depending on which browser you use, steps may vary.
If you use Mozilla Firefox, access the hamburger menu (three horizontal bars) at the top right. Go to History > Clear recent history.
From there, you’ll open a new menu and further options. If you were able to access your site without issue yesterday, then you can choose Today in the time range field, select Cache — you can deselect the other options if you want — and then click Clear Now .
For the most part, the process will be much the same if you’re using Google Chrome, Microsoft Edge, Safari, or something else. If you’re unsure, check the process for clearing cache in other browsers for specific details.
If you try to access your site after clearing the cache and still get a status error, move on to the next step.
4. Flush The DNS Cache
A 502 Bad Gateway error could also be caused by a Domain Name System (DNS) issue. For example, if you’ve just migrated your site to a new web host, the propagation process can take up to 48 hours.
However, the issue may also originate with your local DNS cache. This temporary storage on your device contains information about previously visited domain names.
If you’re using Windows, you can flush the DNS cache using the Command Prompt . To access it, type “CMD” into the Windows search on your taskbar, and press Enter.
You’ll now have access to your Command Prompt .
Once the Command Prompt box is open, copy or type the following command:
Let it run. When it’s finished, you’ll see a message that says, “Successfully flushed the DNS resolver Cache.”
If you’re using a Mac operating system, enter or copy the following command in the terminal.
If you’re uncomfortable doing either of these, you can also use a third-party service such as Google Public DNS to temporarily change your DNS server.
5. Check Your Site’s Error Log
If your site is down for everyone and the problem is local, you can also check your site’s error logs, which may help you identify the cause of your issue. For example, it may flag a plugin conflict or update as the source of your 502 Bad Gateway error.
Your website’s log files can be accessed via a Secure File Transfer Protocol (SFTP) client , such as WinSCP or SmartFTP . Once you’ve installed your client of choice, DreamHost provides a comprehensive Knowledge Base entry on accessing your error logs via SFTP.
Secure File Transfer Protocol (SFTP) is a safer version of the FTP protocol that uses a secure shell data stream.
6. Deactivate Your Plugins And Themes
Although it doesn’t happen often, a new or updated plugin or theme can cause conflict with other plugins or tools, resulting in a 502 Bad Gateway error.
Since you can’t access your WordPress admin dashboard, you’ll need to deactivate your plugins and themes using an SFTP client.
Once you’ve installed or logged into your SFTP client (see the section above for options) please refer to this DreamHost walkthrough for the steps to deactivate/disable your plugins. Note that you have the option of deactivating all of your plugins at the folder level or any single plugin of choice, perhaps the ones you’ve most recently updated or added.
When you’ve completed that step, try accessing your site again. If it’s up and running, log into your dashboard, access your plugins menu, and reactivate each deactivated plugin individually. Each time, make sure you refresh the page to determine if you still have access to your dashboard.
If you identify that a plugin is causing the status code error, either disable or delete it until the developer has released a fix.
If the problem didn’t originate from one of your plugins, you can go through this entire process again, except this time, focus on your Themes folder. Or carry on to the next possible fix.
7. Disable Your CDN Or Firewall
If everything so far has failed, the next thing to check is your Content Delivery Network (CDN) or firewall. Note that your firewall could be a stand-alone plugin, part of your overall security plugin, or implemented by your host.
CDN is an abbreviation for “Content Delivery Network”. It refers to a geographically-distributed network of web servers (and their data centers). The entities that make up a CDN collaborate to ensure speedy content delivery via the internet.
If you’re using Cloudflare , you can check to see if there are any reported issues. For example, the server might be undergoing scheduled maintenance:
If maintenance isn’t the issue, you can also try deactivating both your CDN and firewall through your host’s control panel. Since all hosts do not use the same control panel, it’s recommended that you contact them for assistance.
8. Restart PHP And Increase Your PHP Limits
The 502 Gateway Error could also be caused by a PHP timeout issue. This happens when the PHP process takes longer than the maximum load time and the request timed out.
Restarting PHP may help resolve your connectivity issues. Most hosts provide an option to restart your services via your control panel but if you don’t see that, you may want to ask them to do this for you.
Unfortunately, changing your server’s max_execution_time or max_input_time values may be necessary. By default, WordPress has these values set to 300 seconds, but you can increase PHP execution time via your host’s control panel, or reaching out to their technical support and asking them to do it for you.
9. Contact Your Hosting Provider
If you’ve been through the previous steps and nothing has helped, it’s time to consider contacting your hosting provider. There may be a server issue that’s affecting your site. Unfortunately, if that’s the case, there’s nothing you can do except wait for them to fix it.
Additionally, they may be able to identify the source of your 502 Bad Gateway error and walk you through a solution. Many hosts offer 24/7 support via chat and should be able to resolve the issue quickly.
The 502 Gateway Error is typically caused by a problem at the server. For instance, it may have experienced a spike in traffic that’s affecting performance and availability. However, the error could also be triggered by plugin conflicts and updates.
To troubleshoot the problem, start by clearing your browser cache and local DNS cache to rule out any issues on your end. Then, you can try disabling your plugins, themes, CDN, and firewall. If you’re still experiencing problems, consider contacting your hosting provider for assistance.
If you’re on a shared hosting plan, your 502 error may be because of another website’s traffic spikes. DreamHost offers VPS hosting that provides you with isolated resources and better performance, giving you more control and room to grow. Learn more about our VPS Hosting plans .
We Know You've Got Lots of VPS Options
Here’s how DreamHost’s VPS offering stands apart: 24/7 customer support, an intuitive panel, scalable RAM, unlimited bandwidth, unlimited hosting domains, and SSD storage.
About the Author : Luke Odom
Luke is the Director of IT Operations. He is responsible for the teams that keep operations running smoothly... In his free time, he enjoys reading fantasy/sci-fi and hanging out with his wife and 4 kids. Connect with Luke on LinkedIn: https://www.linkedin.com/in/luke-odom-039986a/
Get Content Delivered Straight to Your Inbox
Subscribe to our blog and receive great content just like this delivered straight to your inbox.
Deploy your app quickly and scale as you grow with our Hobby Tier
How To Fix a 502 Bad Gateway Error
When it comes to websites, there are a lot of different errors that can be downright frustrating and confusing. A few that come to mind are the white screen of death or the frightening error establishing a database connection .
But an even more popular one is the 502 bad gateway error. Why? Because this regularly happens around the entire web, not only to WordPress sites, but even popular services such as Gmail, Twitter, and Cloudflare.
Read more below about what causes this error and some solutions on how to quickly resolve it.
What is a 502 Bad Gateway Error?
The 502 Bad Gateway error specifically means that the server received an invalid response from an inbound server.
The Internet Engineering Task Force (IETF) defines the 502 Bad Gateway error as:
The 502 (Bad Gateway) status code indicates that the server, while acting as a gateway or proxy, received an invalid response from an inbound server it accessed while attempting to fulfill the request.
Every time you visit a website your browser sends a request to a web server. The web server receives and processes the request, and then sends back the requested resources along with an HTTP header and HTTP status code . Typically an HTTP status code isn’t seen unless something goes wrong. It’s basically the servers way of notifying you that something has gone wrong, along with the code on how to diagnose it.
There are many different types of 500 status error codes ( 500 , 501 , 502 , 503 , 504 , 508 , 520 , etc.) which all have slightly different meanings.
These indicate that the request was accepted, but the server prevented the fulfillment of the request.
Check Out Our Video Guide to Fixing Different Types of 500 Errors
What Causes the 502 Bad Gateway Error?
The most likely causes of the 502 Bad Gateway are:
- Server overload: the server ran out of resources and crashed, triggering an HTTP error 502. The possible reasons for this could be an unexpected spike in traffic or low memory.
- Browser problems: your browser version is outdated or maybe there are corrupted files in your browser cache.
- Firewall blocks: your firewall might be detecting false threats and blocking internet providers or IP addresses.
502 Bad Gateway Error Variations
Due to the various browsers, web servers, and operating systems, a 502 bad gateway error can present itself in a number of different ways. But they all have the same meaning. Below are just a couple of the many different variations you might see on the web:
- “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”
- 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
Another variation you might see is a “502 server error.”
And here is yet another variation. “502 – Web server received an invalid response while acting as a gateway or proxy server. There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.”
Other services such as Twitter might even show a completely different message for a 502 Bad Gateway error, such as “Twitter is over capacity.” This definitely looks a little more user-friendly.
And here is a snapshot of how Google displays it. “502. That’s an error. The server encountered a temporary error and could not complete your request. Please try again in 30 seconds. That’s all we know.”
502 Errors Impact on SEO
Unlike 503 errors , which are used for WordPress maintenance mode and tell Google to check back at a later time, a 502 error can have a negative impact on SEO if not fixed right away. If your site is only down for say 10 minutes and it’s being crawled consistently a lot of times the crawler will simply get the page delivered from cache. Or Google might not even have a chance to re-crawl it before it’s back up. In this scenario, you’re completely fine.
However, if the site is down for an extended period of time, say 6+ hours, then Google might see the 502 error as a site level issue that needs to be addressed. This could impact your rankings . If you’re worried about repeat 502 errors you should figure out why they are happening to begin with. Some of the solutions below can help.
How to Fix the 502 Bad Gateway Error? 13 Methods
A 502 bad gateway error is typically a problem with the network/server, however, it can also be a client-side issue. So we’ll dive into a little of both. Check out these common ways to fix the 502 bad gateway error to get back up and running.
1. Try Reloading the Page
One of the easiest and first things you should try when encountering a 502 bad gateway error is to simply wait a minute or so and reload the page (F5 or Ctrl + F5). It could be that the host or server is simply overloaded and the site will come right back.
2. Check the Site Status
Another thing you can do is to paste the website into downforeveryoneorjustme.com . This website will tell you if the site is down or if it’s a problem on your side. There are also other tools that can help .
3. Try a Different Browser
You could try a different browser to rule that out as an issue. If you’re using Google Chrome, for example, try using Microsoft Edge .
In case the error goes away, it might be a good idea to delete and reinstall the browser you initially used.
4. Try in Incognito Mode
You can also access the site in Incognito mode . If the 502 bad gateway error doesn’t happen, the problem might be caused by a browser extension.
But how to identify the culprit extension? Try disabling them gradually, one after the other, checking if the website will open normally.
When this happens, you will have deleted the extension that was blocking your access.
5. Test on Another Device
If it looks like a problem on your end, you can try accessing the website on a different device.
Do the test: use your cell phone’s mobile data to access the page you want to see. If you succeed, restart your computer and other networking equipment, following the classic tip of unplugging your wireless router, waiting a moment, and plugging it back in.
That way you will understand if the error is related to your networking devices or something else.
6. Clear Your Browser Cache
Whenever you encounter issues like these it can be good to clear your browser cache. Below are instructions on how to do it in the various browsers:
- How to Force Refresh a Single Page for All Browsers
- How to Clear Browser Cache for Google Chrome
- How to Clear Browser Cache for Mozilla Firefox
- How to Clear Browser Cache for Safari
- How to Clear Browser Cache for Internet Explorer
- How to Clear Browser Cache for Microsoft Edge
- How to Clear Browser Cache for Opera
7. Check for DNS Issues
A 502 gateway error could also be because of a DNS issue, such as the domain is not resolving to the correct IP, or the DNS server is not responding . If you have just migrated your site to a new host, is it important to wait for things to fully propagate, which can take up to 24 hours in some cases. This depends upon the TTL value of your DNS records.
You can also try flushing your local DNS cache . This is similar to clearing your browser cache.
In Windows simply open up Command Prompt and enter the following:
You should see a “Successfully flushed the DNS resolver Cache” if it worked.
For macOS users, you can enter the following in the terminal:
Note: There is no success message on Macs.
And lastly, you could temporarily change your DNS servers. By default, DNS servers are automatically assigned by your ISP. But you could try temporarily changing these to a public DNS server , such as Googles. In fact, some prefer to use Google’s public DNS long-term. If you have a premium DNS propagation usually is a lot faster.
8. Check With Your Host
The primary reason we typically see a 502 bad gateway error is due to an issue with the web host. Sometimes a query, script, or request will take too long and so it is canceled or killed by the server. A lot of hosts, especially shared hosts implement what they call a “kill script.” Basically what this does is it will terminate a request after a certain period of time so that it doesn’t take a site down or impact other users. If you do a Twitter search for “ bad gateway ” you can see thousands of tweets happening every day alerting their hosting company of the problem.
One reason you might want to consider moving to a host like Kinsta is that our platform runs in an isolated software container that contains all of the software resources required to run the site (Linux, NGINX , PHP, MySQL). This means that the software that runs each site is 100% private and is not shared , even between your own sites. This greatly reduces the chance of seeing a 502 bad gateway error. We aren’t running aggressive kill scripts like some shared hosts are. And even if one of your sites does happen to go down, it won’t impact your other sites.
Another reason you could see a 502 gateway error with your host is also due to the fact that the server is simply not reachable, either because it is down or there is no connectivity. In this case, it is recommended to check your host’s status page or open a support ticket.
9. Temporarily Disable CDN or Firewall
It could also be an issue with your content delivery network (CDN) or firewall . If you are using a 3rd-party CDN provider an easy way to troubleshoot this is to simply disable your CDN temporarily. For example, we are big fans of the free CDN enabler plugin . If you are using that, you can simply deactivate the plugin and then test your site.
Wp-admin not working ? Simply log in to your site via SFTP and rename the plugin’s folder to cdn-enabler_old. This will temporarily disable the CDN connection. The same goes for WP Rocket or any other plugin you might have hooked up to your CDN.
This can also occur sometimes with providers that provide DDoS protection and mitigation or fully proxy services like Cloudflare , as they have extra firewalls in-between. We have noticed that this happens once in a while on the Cloudflare free plan. Unfortunately, since Cloudflare is a fully proxy service, there is no quick way to simply disable it.
However, before you go blaming Cloudflare, it is important to know that there are two different types of 502 bad gateway errors variations with Cloudflare as seen below:
502 Bad Gateway at Cloudflare (Variation 1)
If you see the following screen, this is actually a problem on Cloudflare’s end, in which case you should reach out to them for support. You can also check Cloudflare’s status page to see if they’re currently experiencing an outage.
502 Bad Gateway at Cloudflare (Variation 2)
If you see the following screen, this is a problem with your host.
Here is another example with of an HTTP 502 error and GoDaddy’s firewall. The issue is actually with the origin server (the hosting provider) due to a timeout, not the firewall itself.
10. Check Your Plugins and Themes
A lot of times the reason for scripts and queries being canceled by the server is due to bad code on your site, possibly from a 3rd party plugin or theme. We have also seen a lot of misconfigured caching plugins generate 502 errors. A few ways you can troubleshoot this is by deactivating all your plugins. Remember, you won’t lose any data if you simply deactivate a plugin.
If you can still access your admin , a quick way to do this is to browse to “Plugins” and select “Deactivate” from the bulk actions menu. This will disable all of your plugins . If this fixes the issue you’ll need to find the culprit. Start activating them one by one, reloading the site after each activation. When you see the 502 gateway error return, you’ve found the misbehaving plugin. You can then reach out to the plugin developer for help or post a support ticket in the WordPress repository.
If you can’t access your admin you can FTP into your server and rename your plugins folder to something like plugins_old. Then check your site again. If it works, then you will need to test each plugin one by one. Rename your plugin folder back to “plugins” and then rename each plugin folder inside of if it, one by one, until you find it.
Always makes sure your plugins, themes, and WordPress core are up to date . And check to ensure you are running a supported version of PHP. You can always reach out to your host for assistance. We use Kinsta APM and other troubleshooting methods here at Kinsta to help clients narrow down what plugin, query, or script might be causing the error. You can also use your own custom New Relic key if you have your own license.
If it turns out to be an efficient query or bad code in a plugin, you might need to bring in a WordPress developer to fix the issue.
11. Check Logs
You should also take advantage of your error logs . If you are a Kinsta client, you can easily see errors in the log viewer in the MyKinsta dashboard. This can help you quickly narrow down the issue, especially if it’s resulting from a plugin on your site.
If your host doesn’t have a logging tool, you can also add the following code to your wp-config.php file to enable logging:
If you need more help on how to enable WordPress debugging mode here is a full step by step tutorial .
The logs are typically located in the /wp-content directory. Others, like here at Kinsta might have a dedicated folder called “logs”.
You can also check the log files in Apache and NGINX, which are commonly located here:
- Apache: /var/log/apache2/error.log
- NGINX: /var/log/nginx/error.log
If you are a Kinsta client you can also take advantage of our analytics tool to get a breakdown of the total number of 502 errors and see how often and when they are occurring. This can help you troubleshoot if this is an ongoing issue, or perhaps something that has resolved itself.
12. Restart PHP
Finally, you can also try restarting PHP. If you’re a Kinsta client, you can easily restart PHP from the tools menu within the MyKinsta dashboard. If your host doesn’t provide this, you can always open up a support ticket and ask them restart PHP.
13. Check for PHP Timeout Issues
PHP timeouts occur if a single PHP process runs for longer than the max_execution_time or max_input_time set in the PHP configuration on your server. This is a common occurrence if you’re doing big WordPress imports . When this happens a 502 server error is usually displayed. If you run into a PHP timeout these values may need to be elevated.
You can check with your current host about what values are set on your server and if they can be increased. On the Kinsta platform, these values are set to 300 seconds (5 minutes) by default. The maximum PHP timeout values available on our platform are based on your current hosting plan.
As you can see there are quite a few things you can do to troubleshoot and fix a 502 gateway error on your site. Typically this is not on the client-side, but rather an issue with your host. Third-party plugins and themes with bad code or unoptimized queries are also things to watch out for.
Was there anything we missed? Perhaps you have another tip on troubleshooting 502 gateway errors. If so, let us know below in the comments.
What Is a 502 Bad Gateway Error?
The 502 Bad Gateway error indicates that one server on the internet received an invalid response from another server. It’s a generic error alerting you that there’s something wrong with a website’s server communication.
What Causes the 502 Error?
The 502 bad gateway error is typically caused by issues related to the network/server, however, it can also be caused by client-side issues.
How Do You Fix the 502 Bad Gateway Error?
There are a number of things you can try when attempting to fix the 502 Bad Gateway Error:
- Try Reloading the Page
- Check the Site Status
- Try a Different Browser
- Try in Incognito Mode
- Test on Another Device
- Clear Your Browser Cache
- Check for DNS Issues
- Check With Your Host
- Temporarily Disable CDN or Firewall
- Check Your Plugins and Themes
- Restart PHP
- Check for PHP Timeout Issues
Brian has a huge passion for WordPress, has been using it for over a decade, and even develops a couple of premium plugins. Brian enjoys blogging, movies, and hiking. Connect with Brian on Twitter .
Related Articles and Topics
How to Fix the 504 Gateway Timeout Error on Your Site
How To Fix The “Error Establishing a Database Connection” in WordPress
Nice article, would have liked to see recommendations for people hosting their own sites such as adding buffering, but understand that this is catered more towards people with managed hosting, that being said this article offers some good points on things those people can try.
Thanks Steven! Agreed, I’ll see if we can add some more tips to this.
On my website, 502 Bad Gateway is only caused when I use Cloudflare also Cloudflare causes more problems. Can you help me to solve them without disabling Cloudflare?
Hey Aqib! Sometimes a 502 bad gateway error can be a Cloudflare problem itself, especially on the free plan. However, a more common cause is that you perhaps misconfigured Cloudflare or there is a conflict on your site. It could very well be due to your hosting provider having issues. We always recommend asking your host to see if they can help diagnose the issue.
I contacted my host and they said my DNS was pointing to Cloudflare so I had to change my nameserver back to the original rather than cloudflare. However removing my site from cloudflare hasn’t fixed the problem. I’ll wait 24hours to see if it resolves.
hello, I am having serious troubles, my hosting randomly moved to a new server.
Since I have changed the A record to the new server IP address, nothing works properly, resources are not loading from the wp backend , websites are sometimes scrambled sometimes fine, most of the time when I click on pages of my site I get the 502 error in the second pic chapter 5 in this article, and if I refresh the page it works.
I have spent 8 days chatting with the hosting support and they are not able to fix this.
do you know what it can be?
I have tried everything, disabling Cloudflare, reinstalling plugins, I have sent HAR files all over support teams, nothing works!
Hey Marco! Sorry to hear about your trouble. If none of the above troubleshooting steps worked for you, my best recommendation would be to probably move to a better host. Here at Kinsta we utilize New Relic and can help pinpoint for clients where the issue is.
Hey, a lot of times my website gets an error 502. Please tell me how I can resolve this issue.
Hey Raju! Have you gone through all the troubleshooting steps above? We always recommend chatting with your hosting provider, as they should be able to help.
Thank you for the guidance..
Hello, Have you tried going through the troubleshooting steps above in the post? If you’re a Kinsta client, you can open up a ticket with our support team. Thanks!
Error 522 is an error code from Cloudflare’s proxy service. Please refer to this page here for more information on Cloudflare status codes.
I am having that issues, in the last week, UptimeRobot sending me mails 38 TIMES my site down, 5 minutes for each down, always 502
Leave a Reply Cancel reply
You also agree to receive information from Kinsta related to our services, events, and promotions. You may unsubscribe at any time by following the instructions in the communications received.
502 Bad Gateway Error [Solved]
In more technical terms, the “502” in the error is an HTTP status code which indicates that one server received an invalid response from another server.
There are other categories of 500 errors including:
- 501 – Not Implemented,
- 503 – Service Unavailable
- 504 – Gateway Timeout
- 505 – HTTP Version not supported And many more.
The causes of the 502 bad gateway error include an overloaded server, an error in the code, and yet-to-be-propagated domain names. So the error is often caused by the server of a website and not by you as the user.
But sometimes, the browser might show this error due to past-due updates, ad-blockers, browser extensions and plugins, or even DNS server problems.
In this article, I will show you 5 ways you can fix the 502 bad gateway error so you can access the internet again.
Fix 1: Refresh the Page
Many server errors are only temporary, not permanent, and 502 bad gateway is no exception.
If you’re getting this error, the first thing you should do is refresh the page after a couple of minutes and see if the website loads up again.
If refreshing fails to work, wait a couple of minutes and try again. If the error persists, then proceed to the other fixes in this article.
Fix 2: Try to Access the Website on another Device
Your own device – whether it's a computer or phone – could be the reason you’re getting the 502 bad gateway error. In addition, your internet connection source – router or modem – could be the culprit.
Since this could be the cause, try to access the website on another device or switch your internet connection source.
You can also reboot your devices – computer, mobile phone, router, and modem.
Fix 3: Switch to another Browser
Since the cause of the 502 bad gateway error could be due to an outdated browser or ad blockers, you should consider changing to a different browser and see if the error persists.
For example, if you use the Windows operating system and you’re trying to access the website with Chrome and you're getting the 502 bad gateway error, switch to Edge and vice versa. If you are on Mac and you’re getting the error on Chrome, then consider switching to Safari and vice versa.
If you have Mozilla Firefox installed on your computer, you can also switch to it too. You might get a different experience as it is not built on the same Chromium engine Edge and Google Chrome are built on.
If the website loads up in another browser, then you might need to update the initial browser, reinstall it, or check your extensions and ad blockers.
Fix 4: Clear your Browser Cache
You might be getting the 502 bad gateway error because your browser stored outdated information about the website you’re trying to visit. So, clearing your browser cache could fix the error.
To clear your Chrome browser cache, follow the steps below
To clear your Microsoft Edge cache, follow the steps below
Step 3 : Click on "Privacy, search, and services”.
Fix 5: Flush your DNS Cache
DNS problems could be the reason you keep getting the 502 bad gateway error while trying to visit a website. So flushing your DNS cache could be a solution.
To flush your DNS cache on Windows 10, follow the steps below:
This means all caches will be cleared and websites will be loaded freshly for you.
If you use Chrome, it has its own DNS cache
If you use Edge, it has its own DNS cache too
While it is unlikely for the 502 error to come from the user-side (as it’s a server-related error), you can still try some fixes on your end as the user. That’s why I wrote this article to show you how you can fix the error from your end.
Thank you for reading.
Web developer and technical writer focusing on frontend technologies. I also dabble in a lot of other technologies.
If you read this far, thank the author to show them you care. Say Thanks
Learn to code for free. freeCodeCamp's open source curriculum has helped more than 40,000 people get jobs as developers. Get started
A Simple Explanation of a 502 Bad Gateway Error & How to Resolve It
Updated: October 05, 2020
Published: June 19, 2019
When your website experiences a 502 Bad Gateway Error, it can be like solving a mystery. You don't know what exactly happened or why -- all you know is that something's wrong and you need to fix it.
What causes a 502 bad gateway error?
To guide you through the hassle of fixing the dreaded 502 Bad Gateway Error, let's go over what it exactly is and its most common causes and solutions.
What Is a 502 Bad Gateway Error?
A 502 Bad Gateway Error is a general indicator that there's something wrong with a website's server communication. Since it's just a generic error, it doesn't actually tell you the website's exact issue. When this happens, your website will serve an error web page to your site's visitors, like the photo below.
Picture Credit: Arm Mbed OS
Fortunately, there are seven common and effective solutions for analyzing and fixing most of the causes of 502 Bad Gateway Errors.
The tactics discussed below provide general fixes for 502 Bad Gateway Errors. If you have a WordPress site, this issue may require WordPress-specific solutions .
How to Fix a 502 Bad Gateway Error
- Reload the page.
- Look for server connectivity issues.
- Check for any DNS changes.
- Sift through your logs.
- Fix faulty firewall configurations.
- Comb through your website’s code to find bugs.
- Contact your host.
1. Reload the page.
Sometimes server connectivity issues are resolved relatively quickly. Before you dive deep into what's causing the problem, take steps to ensure that this is actually a major error and not just a blip.
Wait a minute or two. Then reload the page. If the page loads with no error, this might've been a temporary connection problem.
If the page is still giving you an error, clear your browser cache and then try refreshing it once more.
If that doesn't work, move on to investigating the error.
2. Look for server connectivity issues.
Most websites live on multiple servers or third-party hosting providers. If your server is down for maintenance or any other reason, your website could serve visitors a 502 Bad Gateway Error page.
The only way to troubleshoot this issue is to wait for your server to finish maintenance or fix the problem causing the error.
If you don't want to contact your hosting service, one quick way to make this determination could involve running a ping test to see if messages are reaching your IP.
3. Check for any DNS changes.
If you've recently changed host servers or moved your website to a different IP address, it'll make changes to your website's DNS server. This could cause your website to serve its visitors a 502 Bad Gateway Error page.
Your website won't be up and running until these DNS changes take full effect, which can take a few hours.
4. Sift through your logs.
Server logs will provide details about your server's health and status. Sift through them to uncover and respond to any alarming information.
5. Fix faulty firewall configurations.
Your firewall is your website's gatekeeper, protecting your site from malicious visitors or distributed denial-of-service ( DDoS ) attacks.
Sometimes, a faulty firewall configuration will cause your firewall to deem requests from a content delivery network as an attack on your server and reject them, resulting in a 502 Bad Gateway Error. Check your firewall configuration to pinpoint and fix the issue.
6. Comb through your website's code to find bugs.
If there's a mistake in your website's code, your server might not be able to correctly answer requests from a content delivery network. Comb through your code to find bugs or copy your code into a development machine.
It'll perform a thorough debug process that will simulate the situation that your 502 Bad Gateway Error occurred in and allow you to see the exact moment where things went wrong.
7. Contact your host.
If you can't figure out the problem on your own, or if you think your host company is the culprit, give them a call. They may be able to look deeper into what's going on and shed some light on the situation.
If the issue is on their end, they might be able to easily fix it. If the problem is something related to your website specifically, they might also be able to walk you through the solution.
Don't forget to share this post!
Does Google Think Your Website Is Spam?
A Beginner's Guide to Data Flow Diagrams
Image Alt Text: What It Is, How to Write It, and Why It Matters to SEO
The Top 11 Search Engines, Ranked by Popularity
Parts of a URL: A Short Guide
Sitemaps: What They Are, How to Create One & Submit it to Google
The Ultimate Guide to Technical SEO
Full List of Meta Tags, Why They Matter for SEO & How to Write Them
HTTP 500 Internal Server Error: What It Means & How to Fix It
What is a Web Crawler? (In 50 Words or Less)
Access everything you need to run an SEO audit.
- Affordable Luxury: Top-Tier Tech Delights
- Early Black Friday Deals!
502 Bad Gateway Error: What It Is and How to Fix It
This error is usually caused by two different internet servers that are having trouble communicating
- Emporia State University
In This Article
Jump to a Section
What Does a 502 Bad Gateway Error Look Like?
What causes a 502 bad gateway error, how to fix a 502 bad gateway error.
- Frequently Asked Questions
The 502 Bad Gateway error is an HTTP status code that means that one server on the internet received an invalid response from another server. These errors are completely independent of your particular setup, meaning that you could see one in any browser, on any operating system, and on any device.
The 502 Bad Gateway error displays inside the internet browser window, just like web pages do.
Each website can customize the 502 Bad Gateway. While it's fairly uncommon, different web servers do describe this error differently .
Below are some common ways you might see it:
- 502 Bad Gateway
- 502 Service Temporarily Overloaded
- Temporary Error (502)
- 502 Proxy Error
- 502 Server Error: The server encountered a temporary error and could not complete your request
- 502. That's an error
- Bad Gateway: The proxy server received an invalid response from an upstream server
- HTTP Error 502 - Bad Gateway
A Bad Gateway error received in Windows Update generates a 0x80244021 error code or the message WU_E_PT_HTTP_STATUS_BAD_GATEWAY.
When Google services, like Google Search or Gmail, are experiencing a 502 Bad Gateway, they often show Server Error , or sometimes just 502 , on the screen.
Bad Gateway errors are often caused by issues between online servers that you have no control over. However, sometimes, there is no real issue but your browser thinks there's one thanks to a problem with your browser, an issue with your home networking equipment, or some other in-your-control reason.
Microsoft IIS web servers often give more information about the cause of a particular 502 Bad Gateway error by adding an extra digit after the 502 , as in HTTP Error 502.3 - Web server received an invalid response while acting as a gateway or proxy , which means Bad Gateway: Forwarder Connection Error (ARR) .
An HTTP Error 502.1 - Bad Gateway error refers to a CGI application timeout problem and is better to troubleshoot as a 504 Gateway Timeout issue.
The 502 Bad Gateway error is often a network error between servers on the internet, meaning the problem wouldn't be with your computer or internet connection.
However, since it is possible that there's something wrong on your end, here are some fixes to try:
Try loading the URL again by pressing F5 or Ctrl+R ( Command+R on a Mac) on your keyboard, or by selecting the refresh/reload button.
While the 502 Bad Gateway error is usually indicating a networking error outside of your control, it could be extremely temporary. Trying the page again will often be successful.
Start a new browser session by closing all open browser windows and then opening a new one. Then try opening the web page again.
It's possible that the 502 error you received was due to an issue on your computer that occurred sometime during this use of your browser. A simple restart of the browser program itself could solve the problem.
Clear your browser's cache . Outdated or corrupted files that are being stored by your browser could be causing 502 Bad Gateway issues.
Removing those cached files and trying the page again will solve the problem if this is the cause.
Delete your browser's cookies . For similar reasons as mentioned above with cached files, clearing stored cookies could fix a 502 error.
If you'd rather not clear all of your cookies, you could first try removing only those cookies related to the site you're getting the 502 error on. It's best to remove them all but it won't hurt to try the clearly applicable one(s) first.
Start your browser in Safe Mode: We have instructions for Firefox , Chrome , or Edge . Running a browser in Safe Mode means to run it with default settings and without add-ons or extensions, including toolbars.
If the 502 error no longer appears when running your browser in Safe Mode, you know that some browser extension or setting is the cause of the problem. Return your browser settings to default and/or selectively disable browser extensions to find the root cause and permanently fix the problem.
A browser's Safe Mode is similar in idea to the Safe Mode in Windows but it's not the same thing. You do not need to start Windows in Safe Mode to run any browser in its particular "Safe Mode."
Try another browser. Popular browsers include Firefox, Chrome, Edge, Opera, and Safari.
If an alternative browser doesn't produce a 502 Bad Gateway error, you now know that your original browser is the source of the problem. Assuming you've followed the above troubleshooting advice, now would be the time to reinstall your browser and see if that corrects the problem.
Restart your computer . Some temporary issues with your computer and how it's connecting to your network could be causing 502 errors, especially if you're seeing the error on more than one website. In these cases, a restart would help.
Restart your networking equipment . Issues with your modem, router, switches , or other networking devices could be causing 502 Bad Gateway or other 502 errors. A simple restart of these devices could help.
The order you turn off these devices isn't particularly important, but be sure to turn them back on from the outside in . Check out that link above for more detailed help on restarting your equipment if you need it.
Change your DNS servers , either on your router or on your computer or device. Some Bad Gateway errors are caused by temporary issues with DNS servers.
Unless you've previously changed them, the DNS servers you have configured right now are probably the ones automatically assigned by your ISP. Fortunately, a number of other DNS servers are available for your use that you can choose from.
Contacting the website directly might also be a good idea. Chances are, assuming they're at fault, the website administrators are already working on correcting the cause of the 502 Bad Gateway error, but feel free to let them know about it.
Most websites have social networking accounts they use to help support their services. Some even have telephone and email contacts.
If you suspect a website is down for everyone, especially a popular one, checking X (formerly Twitter for chatter about the outage is often very helpful. The best way to do this is to search for #websitedown on X, as in #cnndown or #instagramdown. There are other ways to see if a website is down if social media isn't helpful.
Contact your internet service provider. If your browser, computer, and network are all working and the website reports that the page or site is working for them, the 502 Bad Gateway issue could be caused by a network issue that your ISP is responsible for.
See How to Talk to Tech Support for tips on talking to your ISP about this problem.
Come back later. At this point in your troubleshooting, the 502 Bad Gateway error message is almost certainly an issue with either your ISP or with the website's network—one of the two parties might have even confirmed that for you if you contacted them directly. Either way, you're not the only one seeing the 502 error and so you'll need to wait until the problem is solved for you.
To fix a 404 Page Not Found error , try reloading the web page and ensure you typed the correct URL. You may have the wrong URL, so try searching for the site from a search engine. You can also try clearing your browser's cache and changing the DNS servers, but if it's the website's problem, there's nothing you can do.
There isn't much you can do to fix a 500 internal server error ; the problem usually appears when there's an issue with the page or site's programming. However, you can try reloading the page, clearing your browser's cache, deleting browser cookies, or returning to the website later.
There isn't much you can do to fix a 403 Forbidden error because it typically stems from the site's development and design. To see if the problem is on your end, try checking for URL errors and clearing your browser's cache and cookies. See if the site is working for others; if so, contact the webmaster.
Get the Latest Tech News Delivered Every Day
- 404 Page Not Found Error: What It Is and How to Fix It
- 503 Service Unavailable Error Message: What It Is and How to Fix It
- DNS Servers: What Are They and Why Are They Used?
- How to Fix a 504 Gateway Timeout Error
- Hulu Error Codes: What They Are and How to Fix Them
- How to Fix It When Your ChatGPT Login Isn't Working
- How to Fix a 500 Internal Server Error
- How to Fix a Frozen Computer
- How to Fix the PS4 'Cannot Connect to the Wi-Fi Network' Error
- Is Twitch Down... Or Is It Just You?
- 14 Ways to Fix a ChatGPT Network Error on Long Responses
- How to Fix a 408 Request Timeout Error
- How to Fix a 400 Bad Request Error
- How to Fix a 401 Unauthorized Error
- How to Fix the PS5 'Cannot Connect to the Wi-Fi Network' Error
- Is Google Drive Down...or Is It Just You?
By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts.
How to Fix “502 Bad Gateway" Error?
Table of contents.
Sometimes when you try to visit a site, your browser may load the “502 Bad Gateway” HTTP error page. This error is quite general and it doesn’t provide much information about the actual cause, so you may wonder where to begin in order to fix it.
In the following guide, we examine what is the error “502 Bad Gateway”, what are the common causes, and possible solutions.
What is the “502 Bad Gateway” Error? The “Bad Gateway 502” error indicates that one server, acting as a proxy or remote server, fails to establish a connection to an upstream server.
Usually, when you open a webpage, your browser sends an HTTP request to the server of the website. The hosting server then processes the request, returns a response, and displays the webpage in your browser. When everything is in order, the HTTP response code is 200(OK). Your browser displays the webpage properly and you don’t see any status code.
However, when there is a problem, the webpage’s hosting server can’t process your request. You will see an error page with an error code indicating the cause.
The most common error codes can be categorized into two major groups:
- 4XX codes – client-side errors, indicating that your browser sends an invalid request to the server
- 5XX codes – server-side errors, indicating that the webpage’s server can’t provide a valid response
In other words, the servers communicating to display the site for you can’t establish a connection. This could be the result of high traffic to the website, temporary connectivity issues from your network or device, or website-related errors. The usual result is that you can’t load the requested page. Instead, your browser displays an error page, showing the “502 Bad Gateway” Error.
The look of the page may vary. Depending on the website’s hosting server and proxy services it uses, you may see a different-looking “Bad Gateway Error 502” screen. Below, you can see some examples:
The image above shows a “502 Bad Gateway NGINX” error from a server using NGINX as a reverse proxy, which is a very common web-server setup.
The error page may be further customized by some hosting providers. Below you can see an example of a customized “502 Bad Gateway” Error page:
As you can see, the error pages don’t provide much information about the actual issue. Thus, you may need to troubleshoot the problem further. In the following section, we examine the most common causes of the 502 Bad Gateway error.
How To Fix “502 Bad Gateway” Error and What Are The Causes?
Even though the definition of “502 Bad Gateway” error points out that the issue is from the website’s server, there are various reasons that can cause the error. They can range from an ongoing problem on the website’s hosting server, to connectivity issues from your Internet Service Provider (ISP) or even local DNS errors from your local device.
Here are the most common causes and the possible ways to resolve them.
Temporary connectivity issue
Sometimes, a brief moment of high traffic spike on your network or the website’s hosting server can cause the error.
Usually, such downtime is very short and the error goes away instantly. But you may have opened the website at the exact moment when it was unresponsive.
One of the quickest and easiest ways to find out if the error is gone is to reload the page. You can easily reload the page with the key combination F5 (Control+F5) for Windows or Command+R for Mac.
You may also use the Reload button in your browser. Each browser has a Reload button next to the address bar. For example, you can see the button in Chrome in the following screenshot.
If the website loads after the page is reloaded, you can conclude the error was only momentary and keep browsing.
If reloading the page didn’t fix the issue, you may consider opening the page from another browser. The issue may be specific to the browser you are using and the page might open properly from another one. For instance, if you’ve been using Google Chrome so far, try to open the page from Mozilla Firefox or Microsoft Edge.
If the “502 Bad Gateway” error is not present in another browser, this is a strong indication that the problem is with the browser you’ve been using. You can then proceed to troubleshoot by clearing the browser’s cache and cookies.
Expired browser cache and cookies
To improve the browsing experience, modern web-browsers cache the websites’ resources locally on your device. This allows you to open a website much faster the next time you visit it because the website assets have already been downloaded on your local machine. However, your browser may have saved expired or corrupted cache or cookies which lead to a “502 Bad Gateway” error.
Clearing the browser’s cache and cookies is a simple and quick task that can save you a lot of time for troubleshooting. The exact process varies depending on your browser or device. You can see detailed instructions on how to clear the cache and cookies for your device or browser here:
- How to Clear Cache and Cookies for your desktop browsers
- How to Clear Cache and Cookies for Android
- How to Clear Cache and Cookies for iOS
Browser plugins and extensions
Another possible cause of the “502 Bad Gateway” error may be a plugin or extension in your browser. They may interfere with the connection established between your browser and the website’s server, and cause the error. You may consider disabling them for the sake of troubleshooting.
Let’s take Google Chrome, for example. Navigate to the top-right corner and select the kebab menu . It will open a drop-down menu. Select More Tools . Then, choose Extensions .
This will open the page where the extensions for Chrome are installed. Each extension has a slot with a blue switch. It indicates that the extension is enabled. By clicking on it, the switch will become gray, which will indicate that the extension has been disabled.
You may first disable all extensions. If the “502 Bad Gateway” error goes away, this means that one of the extensions had caused the issue. You can proceed and enable them one by one.
When the culprit is activated again, the error will most likely return. Thus, you will find out which extension caused the error in the first place.
Each browser has a similar page to Chrome’s, where the extensions are controlled. You may proceed and test disabling the extensions for your particular browser application.
Corrupted DNS or other settings from your device
Another possible cause of the “502 Bad Gateway” error may be an outdated DNS cache from your local device. To speed up the DNS lookup, your computer stores DNS settings locally. In general, this improves the browsing experience.
However, if there was a DNS change for the website’s domain, your local DNS cache may store outdated information. This may result in the “502 Bad Gateway” error.
This is why it is recommended to clear your local DNS cache. Depending on your OS (operating system), the process varies. You can see detailed steps for the most common OS systems below:
- How to Clear DNS Cache for Mac OS
- How to Clear DNS Cache for Windows
- How to Clear DNS Cache for Linux
There is a small chance that your router or computer keeps other outdated settings. Restart your network router and your computer as this may fix the issue.
Internet Service Provider (ISP) connectivity issues
The “502 Bad Gateway” error can also be caused by a temporary connectivity issue originating from your local ISP. There may be various reasons – high traffic on their network, a problem that prevents the ISP’s network from connecting to the website’s network, etc.
What you can do is change the network that your device uses. For instance, if you use a mobile device on a Wi-Fi network, you can test by switching to a mobile 3G/4G/5G network. If you use a desktop, you can use your phone as a hotspot and connect to its mobile network.
If the error goes away, it is safe to assume this was a temporary connectivity issue from your network.
It is a good idea to contact your ISP so they can check the connection to the website’s address. They may already be aware of the problem and working on it.
Issues originating from CDN or Firewall Services
Nowadays, many websites use CDN (Content Delivery Network) services and proxy firewalls. These improve the websites’ performance and security. Cloudflare CDN and Sucuri Firewall are some examples of such services.
Although they are very reliable, they are not immune to errors just like any web-based service. When there is extremely high traffic on their networks, a website may show the “502 Bad Gateway” error.
If your site uses such services, one of the first things to check is to disable the CDN or firewall for your domain.
Every CDN or firewall service has a control panel where you can manage its settings. Log in to the control panel and test pausing or temporarily disabling the service.
If the page for the “502 Bad Gateway” error disappears after you stopped the service, it is an indication that the CDN or firewall is the problem. Keep the service disabled for the time being.
You may consider contacting its support team to get more information about the issue. Once the problem is solved, you can activate the service again.
PHP and other errors from the website
Sometimes, the error can be caused by a misconfiguration of the website’s application. The reasons can be conflicts between PHP scripts, an incorrect PHP version for the website, timeouts from CGI scripts, slow MySQL queries, etc.
Change the PHP version of the website
A common cause of PHP errors is an incorrect PHP version set for the website. You may have switched the PHP version, updated your website core files, installed a new plugin or theme, or updated an existing one. The present setup of the website may not be compatible with the PHP version your site uses.
Most hosting providers provide tools to easily switch between PHP versions. SiteGround users can use Site Tools ’s PHP Manage r to change the PHP version with just a few clicks. For more instructions, check this guide on how to switch to a different PHP version .
After the PHP version is changed, try to reload the page. If the error is gone, it means the error was caused by the incorrect PHP version.
For WordPress websites, a common cause is that the plugins or the theme are not compatible with the previous PHP version. If the previous PHP version was higher, you could examine if there is an update for the theme and the plugins. Check if the new update is compatible with the higher PHP version so you can test switching the PHP version again.
Examine the website’s error logs
If switching the PHP version didn’t fix the issue, the error may be related to a specific file or a setting in the website.
When the cause of the “502 Bad Gateway” error originates from the website, there should be an indication of the problem.
The majority of popular website applications have the functionality to report errors in an error log.
For example, you can enable an error log for your WordPress site. You can check the detailed instructions on how to enable debugging from this guide .
From the error log, you can see which files cause a PHP error so you can examine them.
Another method is to use your web hosting’s control panel. Errors detected by the server are registered in an error log, part of the hosting tools.
SiteGround users can access the website’s error logs from Site Tools . Navigate to the section Statistics , then open the section Error Log .
You can see the errors registered by the server. You can explore if the error is related to the “502 Bad Gateway”. The error will also indicate the file related to the error so you can explore it further.
Errors caused by plugins for WordPress websites
The “502 Bad Gateway” error may also be caused by a corrupted or misconfigured plugin, causing a timeout or a conflict with another plugin. You may consider disabling the plugins to see if the error message will disappear.
If the error is gone after the plugins are disabled, you can then enable them one by one. When the faulty plugin is enabled the error will most likely return. You may consider replacing the plugin with an alternative one, providing the same functionality, or contacting the plugin’s support.
Disable the plugins from the WordPress dashboard
To disable the plugins, open your WordPress website’s dashboard. Then, go to the Plugins section , then Installed Plugins . Select Deactivate from the Bulk actions drop-down menu.
Then check the box for Plugins and press Apply.
This is the standard procedure for deactivating the plugins when you have access to the dashboard.
Disable the plugins from the database of the website
In many cases, the ongoing error prevents you from logging in to the dashboard. In such cases, you can disable the plugins from the website’s database.
You can find detailed instructions in this guide.
Disable the plugins from Site Tools
SiteGround users can also use Site Tools ’s WordPress->Install and Manage section to disable all plugins with a single click. For detailed instructions, read this guide.
Hosting provider issues
It is also possible that the error is not originating from the website or your local network. The hosting server of the website may be overloaded or experiencing a more specific setup issue.
If none of the solutions helped solve the “502 Bad Gateway” error, you can consider contacting the web hosting provider that can check the server’s status and help fix the issue.
They may be aware of the problem and already working to resolve it.
The “502 Bad Gateway” error could be due to local connectivity problems, misconfigurations from the website, or server issues. Troubleshooting the error may be cumbersome, but we hope this guide points you in the right direction.
“502 Bad Gateway” is one of the many different HTTP status codes.
Read more about the various errors in these suggested topics:
- HTTP Error Codes Explained
- What is HTTP 500 Error – Internal Server Error and How to Fix it
- What is HTTP 503 Error and How to Fix it
- What is HTTP 504 Error and How to Fix It
- How to Fix ERR_SSL_VERSION_OR_CIPHER_MISMATCH
- What is "Download failed. cURL error 28: Connection timeout after ms" and how to resolve it
- How to Fix ERR_CACHE_MISS Error in Google Chrome (10 Ways)
- How to Fix NET::ERR_SSL_OBSOLETE_VERSION Warning
- How to Fix “DNS Server Not Responding” (11 Ways)
- How to Fix HTTP 429 Error Too Many Requests?
Share This Article
Are you looking for a new host? Our sales team can help you out!
What is a 502 bad gateway error (and how can i fix it).
Why are bad gateways stopping me from seeing a website?
What is a 502 bad gateway error, refresh the page, check if the site is down for other people, try another browser, clear your browser's cache and cookies, check your plugins and extensions, restart your devices, change your dns servers, key takeaways.
A 502 Bad Gateway Error means the website you're connected to tried to relay information from another server and encountered an error. Try refreshing the page, clearing your cache and cookies, disabling your browser extensions, and switching your DNS server to resolve a 502 Gateway Error.
A 502 Bad Gateway Error occurs when you try to visit a web page, but one web server gets an invalid response from another. Normally, the problem is on the website itself, and there's nothing you can do. Other times, this error occurs because of a problem with your computer or networking equipment.
A 502 Bad Gateway Error means that the web server you've connected to is acting as a proxy for relaying information from another server, but it has gotten a bad response from that other server. It's called a 502 error because that's the HTTP status code that the webserver uses to describe that kind of error.
Related: How to Fix a 404 Not Found Error
These bad responses could be due to a number of different causes. It's possible the server is overloaded or there are network issues between the two servers, and it's just a temporary problem. It's also possible there's an improperly configured firewall or even a coding error, and that the problem won't get fixed until those issues are addressed.
Just like with 404 errors , website designers can customize how a 502 error looks. So, you might see different-looking 502 pages on different websites. Websites might also use slightly different names for this error. For example, you might see things like:
- HTTP Error 502 Bad Gateway
- 502 Service Temporarily Overloaded
- Temporary Error (502)
- 502 Server Error: The server encountered a temporary error and could not complete your request
- 502 Bad Gateway Nginx
The vast majority of the time, this is just an error on the server-side of things that you won't be able to do anything about. Sometimes, it's a temporary error; sometimes it isn't. Still, there are some things you can try on your end of things.
Refreshing the page is always worth a shot. Many times the 502 error is temporary, and a simple refresh might do the trick. Most browsers allow you to refresh the page by pressing Ctrl+R on Windows or Cmd+R on Mac, and also provide a Refresh button somewhere on the address bar.
It doesn't fix the problem very often, but it takes just a second to try.
Whenever you fail to reach a site (for whatever reason), you can also check if it's just you that's having a problem connecting, or if other people are having the same trouble. There are lots of tools out there for this, but our favorites are isitdownrightnow.com and downforeveryoneorjustme.com . Both work pretty much the same. Type in the URL you want to check, and you'll get a result like this.
If you get a report saying the site is down for everyone, there's not much you can do but try again later. If the report shows that the site is up, then the problem might be on your end. It's very rare this is the case with a 502 error, but it is possible, and you can try some of the things we describe in the next few sections.
It's possible that an issue with your browser might be causing the 502 Bad Gateway error. One easy way to check this out is to use a different browser and see if it works. You can use Google Chrome , Mozilla Firefox , Apple Safari , or Microsoft Edge . If you can see the error in the new browser as well, then you know it's not a browser issue, and you should try another solution.
If trying a different browser works, it's possible that your main browser has cached outdated or corrupt files that might be causing the 502 error. Removing these cached files and trying to open the website could solve the problem.
It's certainly worth trying, and we've got a handy guide for you on how to clear your history in any browser .
Related: How to Clear Your History in Any Browser
If you use extensions on your browser, then it's possible that one or more of the extensions are causing the problem. Try disabling all your extensions and then accessing the website. If the error disappears after that, then it's likely that a plugin is causing the issue. Enable your plugins one by one to find the culprit.
Related: How to Uninstall Extensions in Chrome, Firefox, and Other Browsers
So, you've used a site checking tool and determined that the site is just down for you. And, you've tested another browser and are having the same problem. So you know the problem is likely something on your end, but it's not your browser.
Related: Why Does Rebooting a Computer Fix So Many Problems?
It is possible that there are some strange, temporary issues with your computer or your networking equipment (Wi-Fi, router, modem, etc.). A simple restart of your computer and your networking devices might help fix the problem.
Sometimes, DNS problems can cause 502 errors. Changing your DNS servers is not a likely fix, but it is a possible one. And it's not too hard to do. Unless you've changed them yourself, your DNS servers are probably be set by your ISP. You can change them to a third-party DNS server like OpenDNS or Google DNS, and that might solve the problem.
And there are other reasons you might want to change DNS servers, too---like better speed and reliability .
Related: The Ultimate Guide to Changing Your DNS Server
- Case studies
What is 502 Error "Bad Gateway": Meaning and How to Fix Issue
What is the 502 Status Code?
Causes for a bad gateway error, 502 errors impact on seo.
- 502 Status Code Common Reasons
- HTTP Status Code Checker
Free SEO Audit
Crawl the website for technical issues and get a prioritized to-do list with detailed guides on how to fix.
A 502 Bad Gateway error is an HTTP status code that means that one server on the internet received an invalid response from another. It’s often a network error between servers on the internet, making the website or service unavailable.
This is not usually a problem with your device or internet connection. Rather, it typically indicates issues between online servers.
For example, when you enter a URL in your browser, your computer sends a request to the server where the website is hosted. The server then processes this request and sends back the requested information along with an HTTP status code to indicate whether the request was successful or not.
When you see a 502 Bad Gateway error, it means that the server acting as a gateway or proxy received an invalid response from the upstream host it accessed in attempting to fulfill the request. In other words, while trying to gather the information needed to display the webpage to you, it received a response it couldn’t use or didn’t expect.
There are several potential causes for a 502 Bad Gateway error. Some of the most common ones include:
Remember, the issue usually resides with the server hosting the website and not on the client’s end (your computer). However, there might be some instances where you could do some troubleshooting on your end, like checking your internet connection, restarting your router, or refreshing the page after a while.
A 502 Bad Gateway error, if not addressed swiftly, can impact your website’s SEO. The reason is tied primarily to the user experience (UX). UX is a crucial factor that search engines consider when determining a site’s ranking. When visitors are frequently met with 502 errors when accessing your website, it can lead to a poor user experience. This causes visitors to leave your site promptly, increasing your site’s bounce rate , which search engines could interpret as a sign of a low-quality site.
On top of the poor user experience, 502 errors also create obstacles for search engine bots . These bots, also known as crawlers, visit your website to index new pages and updates. When they encounter a 502 error, they’re unable to crawl and index the page. This can potentially lead to a drop in your search rankings, particularly if the pages affected are significant to your site’s visibility on search engines.
Prolonged periods of 502 errors resulting in consistent downtime can cause more severe consequences. If a substantial portion of your website is frequently inaccessible due to 502 errors, search engines might temporarily or, in extreme cases, permanently deindex those pages. This scenario can have a dramatically negative effect on your SEO efforts.
Lastly, the occurrence of repeated 502 errors can reduce the perceived trustworthiness of your website. Both users and search engines seek reliable and stable websites. Therefore, sites prone to regular errors are less likely to secure high rankings on search engine results pages.
To avoid these adverse effects, it’s crucial to monitor your website for 502 errors and address them promptly. Regular website maintenance and monitoring can help identify and resolve these issues before they become serious problems.
502 Status Code Common Reasons and How to Fix Them
The 502 Bad Gateway error is often due to issues on the server-side, so it’s not always something you can fix as an end user. However, if you’re a website owner or developer, here are some steps you can take to troubleshoot and potentially resolve 502 Bad Gateway errors:
Check Server Logs
Server logs can often give you a clearer picture of what’s causing the 502 Bad Gateway error. Look for any unusual activity or error messages that occurred around the same time as the 502 errors.
If your server is experiencing more traffic than it can handle, this could be causing the 502 errors.
Problems with your network or your hosting provider’s network can cause 502 errors.
Server Software Issues
Problems with server software or bugs in your website’s code can lead to 502 errors.
Issue with a Proxy Server
If you’re using a proxy server, problems with the server or incorrect configuration could lead to 502 errors.
Remember, if you’re not a website owner or developer, the best course of action is often to report the issue to the website owner or administrator or simply try again later.
HTTP Status Code Checker Tool for Identifying HTTP 502 Errors
HTTP Status Codes Checker is a valuable tool when it comes to detecting HTTP 502 errors. This tool can be beneficial for website owners and administrators to identify potential server issues that might be impacting their site’s performance and user experience.
By inputting the URL of your website into the Sitechecker.pro tool, it will crawl the site and provide a report on the HTTP status codes for each page. If there are any 502 Bad Gateway errors, these will be clearly flagged. This allows you to promptly identify which specific pages are affected by this error, which can be extremely helpful in speeding up the troubleshooting process.
Once you’ve identified the pages experiencing the 502 errors, you can then start to dig deeper into potential causes. It might be related to server overload, network issues, software problems, or even issues with a proxy server. Once you’ve identified and resolved the issue, you can then use the Sitechecker.pro tool again to confirm that the 502 errors have been successfully resolved. It is a continuous, efficient, and effective way of managing and ensuring the smooth operation of your website.
A 502 Bad Gateway error signifies that a server on the internet has received an invalid response from another one, often resulting from network errors, server overloads, software issues, faulty programming, or proxy problems. It is generally a server-side issue, not a problem with your device or internet connection. This error can negatively affect a website’s SEO because it leads to poor user experience and may prevent search engine bots from crawling and indexing pages. Prolonged instances can even lead to temporary or permanent deindexing of pages and reduced perceived trustworthiness of your site.
Regular monitoring and maintenance can help avoid these issues, including using tools like HTTP Status Codes Checker to identify and resolve 502 errors. Server issues causing 502 errors typically need to be addressed by the website’s hosting provider or the server’s administrator. If you’re not a website owner or developer, the best course of action is often to report the issue or try again later.
Why am I receiving a "could not contact entitlement service, status code 502" error?
What is amazon image status code 502, how do i fix error 502, is 502 bad gateway a hack.
Ivan works as a product marketing specialist at Sitechecker. Obsessed with analytics and creating a business strategy for SaaS products.
Check Your Website for SEO Errors
You may also like