10 Fixes: 502 Bad Gateway Error In Browser

When you attempt to access a website, but one web server receives an invalid response from another, a 502 Bad Gateway Error occurs. This is a common issue that may occur to anyone who uses the internet.

10 Best Ways: 502 Bad Gateway Error In Browser

You can do little because the issue lies with the website itself. Other times, your computer or networking hardware may be at fault for this issue. Keep reading more about this issue and how to fix the 502 Bad Gateway Error issue.

What does Status code 502 Bad Gateway Error mean?

The 502 (Bad Gateway) status code indicates that the server while serving as a gateway or proxy, accessed an incoming server and attempted to complete the request but received an invalid response.

On many websites, you could encounter 502 status errors. Additionally, websites may refer to this issue under somewhat different names. For instance, the error is usually called the following:

  • HTTP Error 502 Bad Gateway
  • Temporary Error (502)
  • 502 Bad Gateway Nginx
  • 502 Service Temporarily Overloaded
  • 502 Server Error: The server encountered a temporary error and could not complete your request

An HTTP status code is typically not displayed unless something goes wrong. Essentially, it’s the server’s way of informing you that something is wrong.

What Causes A 502 Bad Gateway Error?

502 bad gateway error occurs due to the common cause in network and hardware. You can solve the problem by going through this troubleshooting guide.

Overloaded Servers.

A server may get overloaded and crash if it runs out of resources, resulting in a 502 Bad Gateway Error. Some typical causes of server overload include a rapid increase in traffic, invalid response from another server, a lack of memory, and software timeouts.

Hardware Issues

There is a substantial risk that your network hardware may be experiencing an intermittent connection issue if you repeatedly receive HTTP 502 Errors from different websites or browsers.

Firewall issues

A firewall protects your website from any erroneous traffic. Some firewall systems may identify false positives because they are overly sensitive. The system may be preventing a request to the server from a CDN or a certain ISP, causing the problem.

Domain Name Issues.

DNS might be causing 502 bad gateway errors. A domain name cannot resolve to the intended IP address. Resolving to the correct IP address may fix the problem.

Browser Errors.

Even if there are no server or network problems, a browser may display a 502 Bad Gateway Error. Ad-blockers, out-of-date browser versions, or damaged cached data in your browser could all be to blame for the issue.

Methods To Troubleshoot 502 Bad Gateway Error Code

Here are some ways to fix the problem of the 502 Bad Gateway Error problem. 

  1. Refresh the WebPage
  2. Try Incognito Mode Or Different Browser
  3. Clear The Browser’s Cache and Cookies
  4. Flush DNS Servers
  5. Check The Plugins And Extensions In Browser (WordPress)
  6. Check if the Site Is Down
  7. Check CDNs or Third Party Firewall
  8. Change your DNS Servers
  9. PHP Timeout Issue
  10. Check Error Log File In WordPress

1. Refresh the WebPage

Refresh the WebPage

The issue might be caused by a temporary increase in network traffic on your system or the server hosting the website. Such downtime is brief, and the temporary error disappears right away. However, it’s possible that you visited the website just as it stopped working.

  • Reloading the page is the simplest approach to see if the error has been fixed.
  • You can quickly reload the website with the F5 key combination (Control+F5 for Windows or Command+R for Mac).
Control+F5 for Windows or Command+R for Mac
  • You can use the browser’s Reload button. The Reload button is located next to the address bar in every browser.
Reload button on web browser
  • If refreshing the page didn’t resolve the problem, you might think about opening the page in a different browser.
  • The problem could be specific to the browser you’re using, and if you use a different one, the page might open without any issues.
  • If the “502 Bad Gateway” error does not appear in another browser, the issue is likely exclusive to the one you used.

2. Try Incognito Mode Or Different Browser

It’s also a good idea to visit the website in Incognito mode to see if the HTTP Error 502 message appears because of a browser-related problem.

  • Choose New Incognito Window from the three dots menu on your browser’s window.
Choose New Incognito Window from the three dots menu
  • A browser extension can blame if the issue doesn’t appear when using Incognito mode.
Incognito mode
  • Try to disable your extensions or add-ons progressively. You should be able to view the website after deleting the one that is generating the issue.
  • Try starting a new browser session if deactivating extensions is unsuccessful. Consider switching to Chrome if you are currently using Opera.
  • Your old browser might be the culprit if the page loads correctly on the new one.

3. Clear The Browser’s Cache and Cookies

There’s a possibility that corrupted and out-of-date files were saved in your browser cache. An HTTP 502 Bad Gateway issue in this scenario can be resolved by deleting the browser’s cache.

Export your data from the browser and import it back later to avoid this. Deleting cached files could result in losing crucial browser information like bookmarks and preference settings. For google chrome, follow these steps.

  • In the top-right portion of the screen, select the icon with three vertical dots. Choose “Clear Browsing Data” from the list of “More Tools” options.
"Clear Browsing Data" from the list of "More Tools" options in google chrome
Ctrl, Shift, and Delete keys
  • You may also type chrome:/settings/clearBrowserData into the address bar as an alternative.
  • Choose the time window for cookie and cache deletion. To expand the menu and choose the required time range, click the arrow in the box next to “Time Range.”
Select the time range for the browser cookies
  • “Cookies And Other Site Data” and “Cached Images And Files” should have checkmarks.
  • Your cache and cookies will be erased after you check the appropriate boxes and click the “Clear Data” button.

4. Flush DNS Servers

DNS issues, such as misconfigured IP addresses and unresponsive servers, might also cause the error. The solution might be to clear the DNS cache.

  • Select the Start menu from the left corner (see the Windows logo).
  • Now select the Command Prompt option.
  • You can hit Windows and R simultaneously and type CMD to launch the command prompt console.
 type CMD in Run to launch the command prompt
  • A popup window can appear and ask you if you wish to give Command Prompt permission to modify your machine. If so, choose Yes.
  • To continue, you must contact your system administrator if you are now prompted for an administrative login.
  • Put the command ipconfig /flushdns into the command prompt window.
  • Enter the key.
ipconfig /flushdns
  • A notification should appear confirming that the DNS Resolver Cache was successfully flushed.
DNS is flushed

5. Check The Plugins And Extensions In Browser (WordPress)

One of the causes of the problem could be bad plugins or themes. This is due to the possibility of theme and plugin conflicts caused by improperly developed plugins. Every script and query on your website will be terminated by your server, rendering it unavailable.

Caching or security plugins are typically at blame for the problem. These plugins can obstruct server connectivity, which would keep the problem from going away.

It’s preferable to deactivate all of your plugins and then reactivate them one at a time if you don’t have any security or caching plugins installed but still get HTTP 502 Errors.

  • Simply select Deactivate from the Bulk Actions option by going to Plugins.
Bulk Actions option in the Plugins
Bulk Actions option in the Plugins
  • After installing each plugin, activate it while refreshing your WordPress website.
  • You can attempt to disable them from your hosting panel or FTP application if you cannot access your WordPress dashboard.
clean unnecessary plugins
  • Rename the plugin’s directory by going to the wp-content directory.
  • Click on Files on your hPanel if you use Hostinger. Go to File Manager, public HTML, and then wp-content from there.
  • You can change the folder’s name to plugins once your site has resumed functioning after all plugins have been disabled.
  • Try enabling each plugin individually to identify which plugin first generated the problem.

6. Check if the Site Is Down

Check if the Site Is Down downdetector

Despite utilizing most strategies, the 502 Error code continues to appear. It’s possible that the server isn’t functioning properly right now.

Various tools are available online to check if a site is down. Check the status of your website on Downdetector by entering its URL.

7. Check CDNs or Third Party Firewall

Check CDNs or Third Party Firewall

Problems with your CDN or DDoS mitigation services might also be a source of 502 Bad Gateway issues. An additional layer is added between your server and a content delivery network. When attempting to connect to your origin server, this layer may encounter problems that cause 502 Errors.

  • Cloudflare is one instance where the 502 Bad Gateway can appear in two different ways depending on the problem.
  • You must contact their customer support staff. Don’t forget first to check the Cloudflare System Status page.
  • If you disable Cloudflare, be aware that it can take a few hours for your DNS to propagate.
  • Your current hosting company is to blame if you encounter the above Cloudflare problem.

8. Change your DNS Servers

  • Click “Open the Network and Sharing Center” from the context menu when you right-click the network status symbol in your system tray.
Open the Network and Sharing Center
  • Click the “Change adapter settings” link in the upper left corner of the “Network and Sharing Center” box.
Click the "Change adapter settings"
  • Right-click the connection for which you wish to modify the DNS settings in the “Network Connections” box, and then select “Properties.” 
Right-click the connection and select properties
  • Select “Internet Protocol Version 4 (TCP / IPv4)” from the list in the properties box, and then click the “Properties” button.
Internet Protocol Version 4 (TCP / IPv4)
  • The DNS settings are displayed in the lower portion of the “Internet Protocol Version 4 (TCP / IPv4) Properties” box.
  • To use the following DNS server addresses, choose that option. Enter the preferred and backup DNS servers’ IP addresses.
    • Preferred DNS Server:
    • Alternate DNS Server:
Preferred DNS Server:
Alternate DNS Server:

9. PHP Timeout Issue

PHP timeouts occur if a single PHP process runs longer than the max execution time or input time specified in the PHP configuration on your server. If you frequently import large amounts of WordPress, this will frequently happen.

  • A 502 server error is typically shown when this occurs. These settings might need to be increased if you have a PHP timeout.
  • You can ask your current WordPress host what parameters are configured on your server and whether they can be raised. 
  • Our platform’s maximum PHP timeout values are accessible based on your current hosting plan.

10. Check Error Log File In WordPress

If you encounter a problem following a specific update or change, your server may be at fault. Checking your website’s error log is the best action for this problem.

  • You may identify which created errors are resulting in a 502 Bad Gateway problem by looking at all of them in the wp-contents/debug.log file.
  • Your hosting provider provides access to enable website error logs through an admin panel.
  • By including the lines below in your wp-config.php file, you may additionally activate error reporting on your WordPress website:
    • define( ‘WP_DEBUG’, true ); 
    • define( ‘WP_DEBUG_LOG’, true ); 
    • define( ‘WP_DEBUG_DISPLAY’, false );


It might be like unraveling a puzzle when a 502 Bad Gateway Error occurs on your website. You are unsure of exactly what occurred or why; all you know is that there is a problem that needs to be resolved.

In the post above, I discussed the typical causes of this issue and provided step-by-step instructions for fixing the 502 Bad Gateway Error. Most of the time, this issue resolves on its own.


How Do I Fix A 502 Bad Gateway Error message?

When a server receives a 502 bad gateway error, the other server provides an incorrect response. Essentially, you’ve established a connection with some sort of temporary device that should acquire all the information you need to view the page. The notice indicates that there was a problem with that process. To resolve this problem, use all of the above approaches.

What Causes A 502 Bad Gateway Error?

The timeout of the proxy was reached before the execution of the request will result in the HTTP 502 bad gateway error. The server acts as a gateway, or the proxy connection breaks when the server’s response is unreliable. It denotes that the server could not process the request due to an unforeseen circumstance. When no other error code is correct, the server will often return this error.

Is 502 Bad Gateway My Problem?

An Error 502 bad gateway is a problem with the website’s server rather than something on your end. This implies that you are not required to investigate your router or look to see whether your Ethernet cable is damaged.

How Do I Fix 502 Bad Gateway In Chrome?

The most effective solutions for fixing Chrome’s 502 Bad Gateway Error include using Incognito mode to find and remove extensions, checking the website’s server status, clearing the browser’s cookies and cache, clearing the DNS cache, and changing the network’s DNS addresses.