What does bad gateway mean

teknikmark

When actively surfing the network, things don't always run smoothly. From time to time users experience HTTP errors instead of a site page. If you encounter error 500 as an internet user, in most cases the problem is not with you or your internet connection, but with the location server. The exception is error 502, which may indicate incorrect settings, especially if the faulty window appears very often and it doesn't matter which site you want to go to. First of all, you need to realize that the methods of resolving the 502 Bad Gateway error are different for the user and the site administrator. Take a closer look at the causes and solutions.

Troubleshooting 502 Bad Gateway.

502 Bad Gateway - what does it mean?

The HTTP internet protocol provides a status code in response to every request. The most common of them is 200: OK, everything works as it should. Usually this status is not displayed. Instead, visitors see the content of the website. Different errors have different reasons: If error 400 means problems with the user, codes from 500 to 511 mean that a negative answer is the result of a server error. The numbers also indicate where the error occurred - at least for users who know what each code means.

Error 502 is usually followed by the phrase Bad Gateway, Bad Gateway Nginx, Bad Gateway Apache, or Bad Gateway: The registered endpoint could not process the request. This wrong gateway error along with the "400: Page not found" error is one of the most common when working on the Internet. It is displayed when the site accessed through the main server failed to route the request. In this case, the first server only acts as a proxy or gateway. It can be said that all inquiries on the Internet are also sent via gateways. Because of this, the appearance of an error window can cause some inconvenience. It is not entirely clear at what point in the process the request detected a malfunction.

Sources of error 502 Bad Gateway

Most of the time, an invalid gateway error occurs on the server side so that a simple user cannot fix it. It is also possible that the browser you are using has registered a 502 Bad Gateway error that actually doesn't exist, or that you are simply being disconnected from the network. The source of the error can also be:

  • Server Error - The gateway from the destination server receives a negative result. This could be due to a system failure. In rare cases, servers can be disconnected from the network if, for example, content violates applicable law.
  • Overloading the web server - When the web server reaches its limit, it can no longer respond to requests. Therefore, the gateway 502 reports Bad Gateway. The reason could be an unexpectedly high level of interest in the site or even a DDoS attack. This means that the attacker used a virtual network to overload the server and cause a system crash.
  • Wrong PHP programming - sometimes the problem is with the site code. Then some inquiries get a negative result.
  • Communication Failures - Firewalls (server and client) can fail to route requests on either side of the connection.
  • Browser Error - causes a website display error and 502 Bad Gateway can expand your browser.

causes

There are 3 main causes of the 502 Bad Gateway error:

  • Domain Name Not Allowed - Domain name by IP address is not allowed. Note that DNS changes can take as long as they are active. This depends on the TTL or "Lifetime" that has been reserved for each record.
  • Source server is not available - Internet connection is not working or not.
  • The firewall blocks the request - the firewall blocks the connection between the Edge Servers and the source servers in the site. This can also be caused by CMS security plugins. Some DDOS security systems are too active and therefore block requests from content delivery servers.

How to Fix Error 502 Bad Gateway

To resolve the 502 Bad Gateway Error, consider solving the problem from the site administrator's perspective. A visitor to your portal shared information with you and received a 502 error message when trying to access your website. What does this mean for you? The administrator is also not always able to correctly determine the cause of the error. First, you need to check that the overall site is available. If your server is really down, contact your hosting provider. You may already know the error and your support team is already working on the recovery. You should also check the server log files for error messages. PHP programming in particular is often a source of error. So check whether the source of the error is in the code or in the database. If necessary, you can use the old backup to quickly fix the error.

Often the error only occurs because the server was temporarily overloaded or was unable to respond to a higher request for too long. If such congestion occurs frequently, contact your hosting provider. Together you can achieve a better configuration of the web server, but this is not always possible. Then you need to check that your firewall is configured correctly and make sure that it is not blocking any legitimate requests. Another source of error can be a malfunction in the name resolution. Check your DNS settings with your hosting provider. Most of the time, 502 will go away on its own after a while. If an error occurs outside of your control, an Internet service provider (ISP) or web server hosting provider will fix it without you having to do anything. If the error was caused by your fault, you need to determine the cause and the method of eliminating it as soon as possible.

Temporarily disable your content delivery network (CDN).

Browser requests are sometimes routed through a reverse proxy server. In other words, using a proxy server establishes a connection between the user's browser and the location server. Some services, such as Content delivery networks (CDNs), such as content delivery networks, use reverse proxy technology to route incoming traffic as efficiently as possible. But sometimes this extra layer can cause problems when trying to connect to the original website server. In this case, your visitors (and you) could run into error 502. It's easy to see if your CDN is causing this problem. You just need to temporarily disable the service and then check that the site loads properly without it. The process of disabling CDN depends on the service you are using.

Now when you try to access a website, the source server will respond to the request with no intermediaries. If the 502 error went away, your CDN was likely causing the problem. In most cases, all you have to do is wait a few hours before turning the service back on. Make sure that the error no longer occurs. If you are using any other CDN, you must read its documentation for instructions on how to temporarily disable the service.

Clear the browser cache

If the problem is really server-side but you need to access the website's content, there are ways to work around the problem. One of them is the browser cache. Modern browsers have been storing copies of websites on their own servers for some time so that they can view an earlier version of them. To load a page from the Google cache, enter cache: in the search field and then enter the URL you want to visit (e.g. cache: //facebook.com). However, you need to remember that you are viewing an outdated version of the website. Clear your browser's cache to fix the error.

Delete your browser cookies

What to do with error 502 In most cases, reloading the page will fix the problem. When the problem is resolved, the server has only been temporarily overloaded. Since such crashes can take a long time, reloading the page in about 15 minutes can help. If you still get the error message, clear the cache and cookies. The browser may just have accessed data from the internal memory of the device. It is not necessary to delete all cookies. In the browser settings, you can only open and delete cookies that are associated with the relevant website.

Start the browser in incognito mode

The error may be on your system even if the status code points to something else. If you see Bad Gateway every time you try to visit websites, the most likely problem is with your computer, browser, or firewall. First, check the browser functionality. The first step is to restart in incognito mode. If that doesn't work properly, start the browser in Safe Mode. If the error goes away, the problem was one of the add-ons or browser extensions disabled in safe mode. To do this, open the command line and enter the full path of the browser location in quotation marks. Every browser developer has different commands to enter Safe Mode:

  • Firefox: "C: \ Program Files \ Mozilla Firefox \ firefox.exe" - security mode
  • Internet Explorer: "C: \ Program Files \ Internet Explorer \ iexplore.exe" –extoff
  • Chrome: Google Browser does not offer Safe Mode. Instead, just run incognito mode.

Correct the DNS server

Error 502 can occur due to incorrect domain name and IP address binding. This is due to the website being migrated to a new host, which usually takes some time. The solution is to clear the DNS cache on the local system while clearing the cache from the browser. Open a command prompt and run the command:

ipconfig / flushdns

If the DNS cache has been cleared successfully, the program displays the message "The DNS cache has been cleared successfully."

Check the logs

Logs are records of all the actions you have taken in an application. You can check the application logs and the corresponding log on the server. Application logs show which pages were requested while the application was running, while the log on the server contains information about the hardware responsible for running the application and the status of all devices connected to the server.

Deactivate CDN plug-in

A content delivery network (CDN) is a third-party service for rendering “large content”, including large images and videos. CDN is used by the application to maintain effectiveness. The firewall configuration may allow invalid or malicious content to pass through the gateway, resulting in a 502 Bad Gateway error. To solve this problem, all you need to do is disable the CDN.

Try a different browser.

Try connecting using a different browser. If the page opens without errors, the current default browser must be removed and reinstalled. If switching browsers doesn't solve the problem with a wrong gateway error, you need to check your network settings. The easiest way is to restart your modem and router. If that doesn't work, try switching from Wi-Fi to LAN and using a wired connection.

Restart your computer and network devices

Sometimes the 502 Bad Gateway is caused by the ISP. The reason for this is an incorrect entry on your DNS server. To work around the error message, enter a different DNS server in the settings. In Windows this can be done in the TCP / IP connection settings. As a test, you can access the free Google DNS server - 8.8.8.8 and 8.8.4.4.

Contact your ISP

If the error was not caused by the provider, then all you have to do is wait for it to go away on its own (or use cached versions of the pages). In most cases, the error is temporary and the administrator will fix it as soon as possible.