Special offer
popup-offers
English
+370 5 205 5502 sales@monovm.com

What is 502 Bad Gateway Error and How to Fix It

There are countless errors you might encounter when using the internet, with error 502 being one of them. Learn how to fix the 502 bad gateway error in today's article.

17 Mar, 21 by Antoniy Yushkevych 4 min Read

In this article, we are going to examine What is a 502 Bad Gateway error and how to fix it. When your website presents a 502 Bad Gateway error, it feels like solving a mystery. You don't know exactly what happened or why – all you know is that something is wrong, and you need to fix it.

A 502 Bad Gateway error is a general indicator that there is a problem with a website's server communication. Since it's just a general error, it doesn't actually tell you the exact problem of the site.

When this happens, your website will display a website with an error to your site visitors. Here are seven things you can do to solve the problem.

 

How to fix a 502 Bad Gateway error

Here are the things you should accomplish to get rid of this error:

  1. Reload the page.
  2. Look for server connectivity issues.
  3. Check for any DNS changes.
  4. Dust off your files.
  5. Fix firewall distortions.
  6. Comb your site code to detect errors.
  7. Contact your hosting provider.

 

  1. Reload the page.

Sometimes server connectivity issues are resolved relatively quickly. Before you plunge deep into what may be causing the problem, follow these steps to make sure this is really a big bug and not just a blip.

  • Wait a minute or two, then reload the page. If the page loads without error, this may have been a temporary connection issue.
  • If the page still gives you an error, clear your browser's cache, and then try refreshing it again. If this does not work, proceed to investigate the error.

 

  1. Look for server connectivity problems.

Most sites are located in parallel on multiple third-party servers or hosting providers. If your server is down for maintenance or for any other reason, your site could serve its visitors a 502 Bad Gateway error page.

The only way to troubleshoot this issue is to wait until your server maintenance is complete or to fix the problem that is causing the error.

If you don't want to contact your hosting service, a quick way to do this determination is to conduct a ping test to see if messages reach your IP.

 

  1. Check for any DNS changes.

If you've recently changed host servers or moved your website to a different IP address, this will make changes to your website's DNS server. This could force your website to serve its visitors to display a page with 502 Bad Gateway errors.

 

  1. Sift the logs.

Server logs will provide details about the status you are experiencing and the status of your server. Sift through them to reveal and respond to any disturbing information.

 

  1. Fix faulty firewall configurations.

The firewall is the gatekeeper of your website, protecting your site from malicious visitors or denial of service (DDoS) attacks.

Sometimes, a faulty firewall configuration will cause your firewall to consider requests from a content provider network as an attack on your server and reject them, leading to a 502 Bad Gateway error. Check the firewall configuration to detect and fix the problem.

 

  1. Scan your site code to detect errors.

If there is an error in your website code, your server may not be able to respond correctly to requests from a content provider network. Scan your code to detect errors or copy your code to a deployment engine.

 

  1. Contact your hosting provider.

If you can't understand the problem yourself or if you think your host company is the culprit, give them a call. They may be able to look deeper into what is happening and shed some light on the situation.

We hope our article helped you understand what is ab 502 bad gateway error and how to fix it. Most of our clients reach directly to our 24/7 support team for such errors and avoid the hassle of troubleshooting by themselves.

Antoniy Yushkevych

Master of word when it comes to technology, internet and privacy. I'm also your usual guy that always aims for the best result and takes a skateboard to work. If you need me, you will find me at the office's Counter-Strike championships on Fridays or at a.yushkevych@monovm.com