Http 502 Error Doordash

The reasons for bad 502 errors can be numerous, from minor browser-related issues to CDN issues.

This article covers some of the troubleshooting steps to take when a 502 Bad Gateway error occurs, both on the server and client sides. We’ll also look at the different factors that can cause this error message and their impact on your website’s SEO.

What does the 502 Bad Gateway error mean?

502 Bad Gateway is an HTTP status code that indicates an error in communication between two servers. It means that the server you are connecting to received an invalid response from the parent server.

This error can occur for various reasons, including server overload, network connectivity, DNS, or website configuration issues. A 502 Bad Gateway error can frustrate users trying to access a website. Still, it usually indicates a temporary problem that can remain resolved by website administrators or hosting providers.

Browsers and servers communicate using HTTP (HyperText Transfer Protocol) status codes. Whenever you access a URL, the browser sends an HTTP request to the web server of the site you are accessing. The server then returns a status code along with the requested resources.

HTTP status codes remain grouped into five server responses:

1xx – informative

2xx – success

3xx – Redirection

4xx – client error

5xx – server error

An HTTP status code starting with the digit “5” refers to errors that occur when there is a network error or communication problem between web servers.

Other 5xx status codes include 500 Internal Server Error, 501 Not Implemented, 503 Service Unavailable, and 504 Gateway Timeout. Although the exact reasons for each error vary, the cause lies with the server in most cases.

What causes a 502 Bad Gateway error?

Before you can fix a gateway error, you need to investigate potential factors causing this error, such as:

Unresolved domain name. It happens when the domain name does not translate to the correct IP. Note that if you have recently migrated your domain name to another host, the DNS server changes may take up to 24 hours to propagate and become fully active.

Congestion of original server. Whenever the origin server runs out of resources, it can become overloaded and crash, causing an HTTP 502 error. Traffic spikes, low memory, and software timeouts are common reasons for server overload.

Browser errors. Sometimes a browser may display a 502 encoding error despite no server or network issues. In this case, the error may remain caused by faulty browser extensions such as ad blockers, outdated versions, or corrupted browser cache files.

Problems with home network equipment. If you encounter HTTP 502 errors on more than one website or browser, there is a good chance that your network device may be experiencing a temporary connection problem.

Firewall blocks. A firewall protects your website from any suspicious traffic. However, some firewall systems are too sensitive and can detect false alarms. The system can block a specific ISP or a request from a CDN.

How to Fix 502 Bad Gateway Error

Although the 502 Bad Gateway error usually relates to server-side problems, it can also remain caused by misconfigurations or temporary issues from the client side. Hence, we’ll overview the common troubleshooting steps with both causes in mind.

While some solutions remain focused on WordPress, most can remain applied to any website.

  1. Refresh the Page

The first solution is relatively simple–wait for a minute or two and refresh the web page you’re on. In many cases, the error comes from a sudden traffic surge.

Thus, a simple page refresh usually will do the trick. Windows users can press F5 or CTRL + F5 for a shortcut, while Mac users can press CMD + R.

You can also try checking if the website is offline using an online tool like Website Planet or Host Tracker. It will help identify whether a server or a client-side issue causes the error.

  1. Clear Browser Cache

If the error persists, there is a chance that your browser cache has saved outdated and corrupted files. In this case, clearing the browser cache can fix an HTTP 502 Bad Gateway error.

Remember that removing cached files might risk losing important browser data, including bookmarks and setting preferences. To prevent this, export your data from the browser and import it back after.

  1. Try in Incognito Mode

Accessing the website using Incognito mode is also a good idea as it helps determine whether the HTTP Error 502 message appears due to a browser-related issue. To open an Incognito window, click the three-dots button on your browser screen and choose New Incognito Window.

If the error doesn’t occur in Incognito mode, the problem might remain caused by a browser extension.

With that in mind, try to disable your add-ons or extensions gradually. Once you delete the one causing the error, you can access the website.

If disabling extensions doesn’t help, try opening a new browser session. For example, if you’re currently on Google Chrome, try using Mozilla Firefox.

When the page loads generally on the new browser, your previous browser might be causing the error. To solve the problem, try deleting and reinstalling your faulty browser.

  1. Flush the DNS servers

The error can also occur due to DNS issues such as incorrect IP addresses and unresponsive DNS servers.

In this case, flushing the DNS cache may be the solution. This method works similarly to clearing the browser cache. It removes bad files from your DNS server.

Temporarily changing your DNS servers is another step you can take. By default, DNS servers are assigned by your ISP. However, you can always change it to a third-party server such as Google Public DNS.

  1. Test on another device

If none of the solutions above fixed the HTTP 502 error, test the connection on another computer or mobile device, preferably connected to a different network.

Try restarting your computer and other network devices. To do this, turn off the computer and disconnect the wireless router. Wait a while and plug them in again.

This step helps decide if the error is related to your network device or if the problem lies elsewhere.

  1. Check the error log

If an error occurs after a certain change or update, the error may lie with the server itself. The best solution to this problem is to check your site’s error log. Your hosting service usually provides access to enable the website error log through the admin dashboard.

All errors generated will appear in the wp-contents/debug.log file, allowing you to identify which ones are causing the 502 Bad Gateway error.

  1. Review plugins and themes

Sometimes faulty plugins or themes can be one of the reasons for the error.

Badly coded plugins and themes can collide with each other. When this happens, your server stops every script and query on your site, making it inaccessible.

For some websites, the problem usually comes from cache or security plugins. There is a good chance that these plugins are blocking server-to-server communication, causing the error to persist.

If you don’t have a cache or security plugin installed but still encounter HTTP 502 error, it’s best to disable the plugins and re-enable them one by one. To do so, go to Plugins and simply click Deactivate from the Bulk Actions menu.

Then activate each plugin and refresh your WordPress site after each one. Once the 502 error appears again, you’ve found the problematic plugin.

However, if you can’t access your WordPress dashboard, you can try disabling them from your hosting panel or FTP program. Go to the wp-content directory and rename the plugins directory, for example, plugins-disable.

If you are using Hostinger, open your hPanel and click on Files. From there, go to File Manager -> public_html -> wp-content.

Once your site is up and running after disabling all plugins, you can rename the folder back to plugins. Then try enabling the plugins individually to see which is causing the error.

If the site is still not working, follow the same steps with WordPress themes.

  1. Check CDNs

Another cause of 502 Bad Gateway errors could be issued with your CDN or DDoS mitigation services.

A content delivery network adds another layer between your server and browser to deliver web content efficiently. However, this layer may encounter a problem connecting to your origin server, resulting in 502 errors.

One notable example would be Cloudflare, where a 502 Bad Gateway can occur in two different variations depending on the issue.

The above screen shows that the problem is on the Cloudflare side. You will need to contact their customer support team to fix this. Be sure to check the Cloudflare System Status page before doing so.

Alternatively, you can choose to disable Cloudflare, although be aware that your DNS propagation may take several hours.

However, if you see the Cloudflare error above, the problem lies with your current hosting provider. In this case, try contacting your web host’s support team for assistance.

  1. Check the Site Status

If the 502 Error code is still showing up despite trying most of the methods so far, the origin server might be experiencing a downtime.

Luckily, there are many tools on the web to examine if a site is down, including Down for Everyone or Just Me and IsItDown. Simply input your URL and check the status of your website.

  1. PHP max_execution_time and max_input_time

PHP timeout happens whenever a PHP process loads for more than the specified max_execution_time or max_input_time. These are the values set in your PHP configurations on your web server. Usually, the values are set to 300 seconds by default.

A timeout can happen during the migration process and trigger a 502 Bad Gateway error. To fix this issue, you can talk to your web host to check your values and if you can increase them.

Conclusion

A 502 Bad Gateway happens when a server that functions as a gateway receives an invalid response from the origin server. If left untreated, this error will impact your conversion rate, the user experience, and page rankings.

As the status code suggests, the root of this error usually lies on the server side. In other words, the problem doesn’t come from your website, internet connection, or computer. With that in mind, keeping an eye out for broken plugins or themes is also essential.

We hope these troubleshooting steps help you remove any errors you might run into and return your site to a stable condition. If you have any extra tips or solutions, please share them with us in the comments below.