Get your new or upgraded website now with 6 or 12 month payment plans for new websites or refreshes.

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.

502 bad gateway error

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

  1. Reload the page.
  2. Look for server connectivity issues.
  3. Check for any DNS changes.
  4. Sift through your logs.
  5. Fix faulty firewall configurations.
  6. Comb through your website’s code to find bugs.
  7. 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 insure 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.

Before we perform a single task, our experts complete a backup of your website to ensure that it’s fully protected and can be restored

WordPress Development

Get your websites back-end sorted right. Select from any of the categories below. Each bullet represents one credit. Click here for the full catalogue of services.

Including:

  • Enable logs and/or WordPress debug mode to diagnose the issue.
  • Attempt to resolve the issue if the website or logs reveal a plugin or widget related error.

Install, activate or update a Plugin

  • Install and activate one custom plugin, purchased plugin or plugin from the WordPress catalog
  • Update any number of installed plugin(s) to the current live release using WordPress Dashboard

>> You must specify which plugin(s) to update.

  • Manually update one plugin

>> Example: A specific version provided to us by uploading it to the hosting account

>> If none are specified, we will update the currently active theme

  • Manually update one theme

>> Example: A specific version provided to us by uploading it to the hosting account

Troubleshoot and fix WordPress plugin issues

  • Enable logs and/or WordPress debug mode to diagnose the issue
  • Attempt to resolve the issue if the website or logs reveal a plugin related error

Config file changes

  • Enable a specified PHP module installed on the Hosting
  • Modify the value of a PHP setting
  • Enable or disable debug mode
  • Disable Cache
  • Remove the FTP prompt when installing or updating a plugin
  • Update database connection information in WordPress configuration
  • Reconnect a WordPress database and files

Unable to log in to WordPress

Troubleshoot and fix WordPress image issues

Troubleshoot and fix 404 error, broken links, or redirect issues

Troubleshoot and fix WordPress core file errors

Troubleshoot and fix a WordPress White Screen of Death

Troubleshoot and fix a WordPress internal server error

Troubleshoot and fix a contact form issue

Theme Maintenance

Tasks include making sure your website looks professional. Select from any of the below items. Each one represents 1 monthly credit. Click here for the full catalogue of services.

Install, change or update a theme

  • Install and activate one custom theme, purchased theme or theme from the WordPress store
  • Update any number of installed themes to the current live release of theme using WordPress Dashboard

>> If none are specified, we will update the currently active theme

  • Manually update one theme

>> Example: A specific version provided to us by uploading it to the hosting account

Troubleshoot and fix theme errors

  • Enable logs and/or WordPress debug mode to diagnose the issue
  • Attempt to resolve the issue if the website or logs reveal a theme related error

Create and activate a child theme

  • Create and activate a child theme

Customise a theme

  • Modify one of the following for a theme:

>> Header

>> Sidebar

>> CSS

>> Background

>> Menu

>> (Each modification along with one revision will consume 1 credit.)