InfoPhilic WordPress Guide to Fix 502 Bad Gateway Error on your WordPress Site

Guide to Fix 502 Bad Gateway Error on your WordPress Site

Running WordPress blog/site, you might have faced 502 bad gateway error once in a while. Right? I’m sure you did.

However, this is one of the most popular error messages on the Internet. This also happens with popular services such as Gmail, Twitter, etc. But that does not mean taking it lightly. Driving a blog/site also requires care. Of course, we have to do, because we can only care about how it impacts your WordPress site.

Facing such error sometimes is quite frustrating, challenging and confusing as well. Don’t panic, Let’s know it in detail.

What is 502 Bad Gateway Error?

It is an HTTP status code that suggests one server on the internet received an invalid response from another server.

Let me explain,


Whenever you visit any website, the client (your browser) sends a request to a web server. The server then responds to the client request by using a proxy or a gateway. If the proxy or gateway received an invalid response from the server, it generates the HTTP 502 Bad Gateway Error.

This error seems in variations according to browsers, web servers, and operating systems. The variations are as follows:

  • 502 Bad Gateway
  • Error 502
  • HTTP Error 502 – Bad Gateway
  • 502 Service Temporarily Overloaded
  • 502 Proxy Error
  • 502 Server Error: The server encountered a temporary error and could not complete your request
  • HTTP 502

What causes the 502 Bad Gateway Error?

The error may arise because of following reasons:

  • The origin server cannot be reached.
  • If there are any issues with your internet browser and it cannot access the website or a web page.
  • If the server is down and cannot be accessed.
  • If the server has become overloaded.
  • The Internet gateway or router is unable to pull content from the origin server.

This is all about HTTP 502 error that we have to fix it before it affects your blog/site. It is as same as you provide medication to yourself when you fall sick. At last, it is your website and you have to care it for multiple reasons including better SEO, good ranking etc.

So now, let’s jump to the point – How to fix 502 error?

It can be sometimes client side and sometimes server side issue. So we will cover both.

How to Fix 502 Bad Gateway Error?

1. Check if Website is really down:

The primary task you have to do after noticing the error message is to check whether the site is really down. There are various web tools available for this task, that may help you.

2. Try Reloading the page:

Sometimes the arises for temporary only. It could be frequently the host or server is overloaded and your site will make revival after an instance.

3. Clean Caches and Cookies:

Stored cache in a browser while checking site provide a cached version of the site that may confuse you. thus, it is better to clean your browser cache.

If the browser gets overloaded with cookies, it may generate the error. Clean your browser cookies and lets the browser store fresh cookies.

4. DNS issue:

The error may take place due to DNS issue, for example – the domain is not able to resolve correct IP.

Try flushing your DNS cache. For that do the following steps:

  • Open the command prompt on your computer.
  • Enter command:
ipconfig /flushdns
  • A message will appear: Successfully flushed the DNS Resolver Cache
  • For macOS users, enter command,
dscacheutil -flushcache

5. Check with your Host:

If there is a problem with the web host, the error may take place. Sometimes a query or request take a long time to respond. Thus, it gets declined by web server i.e., the server terminates the request so that it doesn’t take a site down or impact other users.

6. Check your Plugins and Themes:

Make sure you are not using 3rd party plugins or themes. Using them generates bad code in your WordPress site and you regularly likely to face such or likewise errors.

In addition, misconfigured plugins also generated the error. Fixing the error requires deactivating such plugins.

A similar thing happens if using 3rd party themes. So, make sure you are using the theme from a trusted party and ask your theme developer to configure it properly.

7. Check Error logs:

Your hosting provider facilitates error log. Take benefit of it and quickly identify what’s going wrong with your WordPress site.

8. Disable CDN for temporary:

The error may generate if there is an issue with your CDN (Content Delivery Network). An easy way to fix it by temporarily disabling it.

Most of the bloggers more likely to use CDN enabler plugin. Deactivate it and test your site. In case, you are unable to login your WordPress dashboard, then

  • Login into your SFTP.
  • Rename the plugin’s folder to CDN-enabler_old.
  • Doing this will temporarily disable CDN connection.

For the users who use CloudFlare:

CloudFlare is a fully proxy service. Thus, you can’t disable it quickly. But, before blaming CloudFlare, it is essential to confirm whether the problem arising from your end or by CDN. There are two ways to identify it:

  1. Variation 1:

If you notice following screen, then it is the problem with CDN. You have to contact them for support:

Easy Guide to Fix 502 Bad Gateway Error on your WordPress Site
Image: CloudFlare variation 1

2. Variation 2:

If you see the following screen, this is a problem with your host.

Easy Guide to Fix 502 Bad Gateway Error on your WordPress Site
Image: CloudFlare variation 2


There are few things you can do to troubleshoot and fix a 502 gateway error. I hope, trying these ways help you best in fixing 502 error. Feel free to ask any doubts in the comment section below.

Amit Malewar
Amit Malewar has been the tutorial writer since 2013. His passion for helping people in all aspects of technology flow through the expert coverage he provides. In addition to writing for InfoPhilic, Amit loves to read and try new things.

Comment Policy: Your words are your own, so be nice and helpful if you can. Please, only use your real name and limit the amount of links submitted in your comment. We accept clean XHTML in comments, but don't overdo it please.


  1. Saludos, gracias por la informacion. EL problema que tengo es que si puedo visualizar la web, pero cuando quiero realizar un test con SCREAMING FROG me dice error 502. Que puedo hacer ? Gracias


Please enter your comment!
Please enter your name here



Get almost 100% PageSpeed on Newspaper theme

The newspaper theme is the most popular premium theme for a self-hosted WordPress blog. The theme is developed by team tagDiv. You can buy...

How to Remove jQuery Migrate in WordPress?

Learn how to remove jQuery Migrate from your WordPress site.

How to Delete Multiple Images in WordPress Media Gallery

Hey, guys, today, one of my friends asked me a question, How can I delete Multiple Images in WordPress? I replied, "It's very simple." Yeah,...

How To Reduce Admin-Ajax Server Load In WordPress

To increase better user experience, we always end up by increasing site speed. After clicking a website link seems like a simple thing. But...

How to create News Sitemap for WordPress site?

Learn how to create special news sitemap for your WordPress blog/ website using Yoast News SEO plugin and Jetpack plugin.



SEOPressor plugin gives you maximum SEO clarity on your WordPress sites with features designed for controlling WordPress SEO with ease.