When it comes to lớn websites, there are a lot of different errors that can be downright frustrating and confusing. A few that come to mind are the trắng screen of death or the frightening error establishing a database connection.

Bạn đang xem: Azure

But an even more popular one is the 502 bad gateway error. Why? Because this regularly happens around the entire web, not only khổng lồ WordPress sites, but even popular services such as Gmail, Twitter, và Cloudflare.

Read more below about what causes this error và some solutions on how to quickly resolve it.

What is a 502 Bad Gateway Error?

The 502 Bad Gateway error specifically means that the vps received an invalid response from an inbound server.

The internet Engineering Task Force (IETF) defines the 502 Bad Gateway error as:

The 502 (Bad Gateway) status code indicates that the server, while acting as a gateway or proxy, received an invalid response from an inbound server it accessed while attempting to fulfill the request.

Every time you visit a website your browser sends a request to lớn a web server. The web server receives và processes the request, và then sends back the requested resources along with an HTTP header and HTTP status code. Typically an HTTP status code isn’t seen unless something goes wrong. It’s basically the servers way of notifying you that something has gone wrong, along with the code on how to lớn diagnose it.

There are many different types of 500 status error codes (500, 501, 502, 503, 504, 508, 520, etc.) which all have slightly different meanings. These indicate that the request was accepted, but the server prevented the fulfillment of the request. spoiled me so bad that I demand that cấp độ of service from every provider now. We also try khổng lồ be at that màn chơi with our SaaS tool support.

Suganthan Mohanadasan from
Suganthanmn View plans
502 bad gateway error in Chrome

Check Out Our clip Guide lớn The 502 Error

502 Bad Gateway Error Variations

Due khổng lồ the various browsers, web servers, & operating systems, a 502 bad gateway error can present itself in a number of different ways. But they all have the same meaning. Below are just a couple of the many different variations you might see on the web:

“502 Bad Gateway”“Error 502”“HTTP Error 502 – Bad Gateway”“502 Service Temporarily Overloaded”“502 Proxy Error”A blank white screen“502 server Error: The vps encountered a temporary error and could not complete your request”“HTTP 502”Temporary Error (502)502. That’s an error502 bad gateway CloudflareBad Gateway: The proxy vps received an invalid response from an upstream server

Another variation you might see is a “502 server error.”

502 hệ thống error in Chrome

And here is yet another variation. “502 – Web server received an invalid response while acting as a gateway or proxy server. There is a problem with the page you are looking for, and it cannot be displayed. When the Web hệ thống (while acting as a gateway or proxy) contacted the upstream nội dung server, it received an invalid response from the content server.”

502- web hệ thống received an invalid response

Other services such as Twitter might even show a completely different message for a 502 Bad Gateway error, such as “Twitter is over capacity.” This definitely looks a little more user-friendly.

Twitter is over capacity (Img src: Softpedia)

And here is a snapshot of how Google displays it. “502. That’s an error. The hệ thống encountered a temporary error and could not complete your request. Please try again in 30 seconds. That’s all we know.”

Google 502 error

502 Errors Impact on SEO

Unlike 503 errors, which are used for WordPress maintenance mode & tell Google to check back at a later time, a 502 error can have a negative impact on SEO if not fixed right away. If your site is only down for say 10 minutes và it’s being crawled consistently a lot of times the crawler will simply get the page delivered from cache. Or Google might not even have a chance to lớn re-crawl it before it’s back up. In this scenario, you’re completely fine.

However, if the site is down for an extended period of time, say 6+ hours, then Google might see the 502 error as a site màn chơi issue that needs to lớn be addressed. This could impact your rankings. If you’re worried about repeat 502 errors you should figure out why they are happening to lớn begin with. Some of the solutions below can help.

How lớn Fix the 502 Bad Gateway Error

A 502 bad gateway error is typically a problem with the network/server, however, it can also be a client-side issue. So we’ll dive into a little of both. Kiểm tra out these common causes and ways to fix the 502 bad gateway error to & get back up & running.

Don’t just manage your trang web errors—reduce the risk of them ever happening at all. Try for Free.

1. Try Reloading the Page

One of the easiest & first things you should try when encountering a 502 bad gateway error is to simply wait a minute or so and reload the page (F5 or Ctrl + F5). It could be that the host or hệ thống is simply overloaded và the site will come right back. While you’re waiting, you could also quickly try a different browser to rule that out as an issue.

Another thing you can vì chưng is khổng lồ paste the website into This trang web will tell you if the site is down or if it’s a problem on your side.


2. Clear Your Browser Cache

Whenever you encounter issues lượt thích these it can be good to lớn clear your browser cache. Below are instructions on how to vì it in the various browsers:

3. DNS Issue

A 502 gateway error could also be because of a DNS issue, such as the domain is not resolving to the correct IP, or the DNS server is not responding. If you have just migrated your site khổng lồ a new host, is it important lớn wait for things khổng lồ fully propagate, which can take up to lớn 24 hours in some cases. This depends upon the TTL value of your DNS records.

You can also try flushing your local DNS cache. This is similar to clearing your browser cache.

In Windows simply mở cửa up Command Prompt & enter the following:

ipconfig /flushdns

Command prompt – flush DNSYou should see a “Successfully flushed the DNS resolver Cache” if it worked.

For macOS users, you can enter the following in the terminal:

dscacheutil -flushcacheNote: There is no success message on Macs.

And lastly, you could temporarily change your DNS servers. By default, DNS servers are automatically assigned by your ISP. But you could try temporarily changing these to a public DNS server, such as Googles. In fact, some prefer to use Google’s public DNS long-term. If you have a premium DNS propagation usually is a lot faster.

4. Kiểm tra With Your Host

The primary reason we typically see a 502 bad gateway error is due to an issue with the website host. Sometimes a query, script, or request will take too long and so it is canceled or killed by the server. A lot of hosts, especially shared hosts implement what they hotline a “kill script.” Basically what this does is it will terminate a request after a certain period of time so that it doesn’t take a site down or impact other users. If you vị a Twitter tìm kiếm for “bad gateway” you can see thousands of tweets happening every day alerting their hosting company of the problem.

502 bad gateway tweets

One reason you might want khổng lồ consider moving to lớn a host like is that our platform runs in an isolated software container that contains all of the software resources required lớn run the site (Linux, NGINX, PHP, MySQL). This means that the software that runs each site is 100% private & is not shared, even between your own sites. This greatly reduces the chance of seeing a 502 bad gateway error. We aren’t running aggressive kill scripts like some shared hosts are. Và even if one of your sites does happen to lớn go down, it won’t impact your other sites.

Xem thêm: Tuyến Cáp Quang Đứt 2017 - Cáp Quang Aag Gặp Sự Cố Đầu Tiên Trong Năm 2017

Another reason you could see a 502 gateway error with your host is also due to lớn the fact that the server is simply not reachable, either because it is down or there is no connectivity. In this case, it is recommended to check your host’s status page or mở cửa a tư vấn ticket.

5. Temporarily Disable CDN or Firewall

It could also be an issue with your content delivery network (CDN) or firewall. If you are using a 3rd-party CDN provider an easy way khổng lồ troubleshoot this is lớn simply disable your CDN temporarily. For example, we are big fans of the miễn phí CDN enabler plugin. If you are using that, you can simply deactivate the plugin and then thử nghiệm your site. Wp-admin not working? Simply log in to lớn your site via SFTP and rename the plugin’s thư mục to cdn-enabler_old. This will temporarily disable the CDN connection. The same goes for WP Rocket or any other plugin you might have hooked up to lớn your CDN.

Rename plugin thư mục temporarily

This can also occur sometimes with providers that provide DDoS protection và mitigation or fully proxy services lượt thích Cloudflare, as they have extra firewalls in-between. We have noticed that this happens once in a while on the Cloudflare free plan. Unfortunately, since Cloudflare is a fully proxy service, there is no quick way khổng lồ simply disable it.

However, before you go blaming Cloudflare, it is important khổng lồ know that there are two different types of 502 bad gateway errors variations with Cloudflare as seen below:

502 Bad Gateway at Cloudflare (Variation 1)

If you see the following screen, this is actually a problem on Cloudflare’s end, in which case you should reach out to lớn them for support. You can also kiểm tra Cloudflare’s status page to lớn see if they’re currently experiencing an outage.

502 bad gateway error502 Bad Gateway at Cloudflare (Variation 2)

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

Cloudflare 502 bad gateway at hostGoDaddy Firewall

Here is another example with of an HTTP 502 error and GoDaddy’s firewall. The issue is actually with the origin hệ thống (the hosting provider) due khổng lồ a timeout, not the firewall itself.

HTTP 502 – GoDaddy Firewall

6. Kiểm tra Your Plugins và Themes

A lot of times the reason for scripts and queries being canceled by the server is due to bad code on your WordPress site, possibly from a 3rd buổi tiệc nhỏ plugin or theme. We have also seen a lot of misconfigured caching plugins generate 502 errors. A few ways you can troubleshoot this is by deactivating all your plugins. Remember, you won’t thua kém any data if you simply deactivate a plugin.

If you can still access your admin, a quick way to do this is to browse khổng lồ “Plugins” and select “Deactivate” from the bulk actions menu. This will disable all of your plugins. If this fixes the issue you’ll need khổng lồ find the culprit. Start activating them one by one, reloading the site after each activation. When you see the 502 gateway error return, you’ve found the misbehaving plugin. You can then reach out to the plugin developer for help or post a support ticket in the WordPress repository.

Deactivate all plugins

If you can’t access your admin you can FTP into your server & rename your plugins thư mục to something lượt thích plugins_old. Then kiểm tra your site again. If it works, then you will need to thử nghiệm each plugin one by one. Rename your plugin thư mục back to “plugins” và then rename each plugin thư mục inside of if it, one by one, until you find it.

Rename plugin folder

Always makes sure your plugins, themes, và WordPress vi xử lý core are up khổng lồ date. And kiểm tra to ensure you are running a supported version of PHP. You can always reach out khổng lồ your host for assistance. We use APM and other troubleshooting methods here at to help clients narrow down what plugin, query, or script might be causing the error. You can also use your own custom New Relic key if you have your own license.

Time-consuming queries khổng lồ the database

If it turns out khổng lồ be an efficient query or bad code in a plugin, you might need to lớn bring in a WordPress developer to fix the issue.

7. Kiểm tra Logs

You should also take advantage of your error logs. If you are a client, you can easily see errors in the log viewer in the dashboard. This can help you quickly narrow down the issue, especially if it’s resulting from a plugin on your site.

Check error logs for 502 bad gateway errors

If your host doesn’t have a logging tool, you can also địa chỉ cửa hàng the following code khổng lồ your wp-config.php tệp tin to enable logging:

define( "WP_DEBUG", true );define( "WP_DEBUG_LOG", true );define( "WP_DEBUG_DISPLAY", false );If you need more help on how to enable WordPress debugging mode here is a full step by step tutorial.

The logs are typically located in the /wp-content directory. Others, like here at might have a dedicated thư mục called “logs”.


You can also check the log files in Apache & NGINX, which are commonly located here:

Apache: /var/log/apache2/error.logNGINX: /var/log/nginx/error.log

If you are a client you can also take advantage of our analytics tool to get a breakdown of the total number of 502 errors và see how often and when they are occurring. This can help you troubleshoot if this is an ongoing issue, or perhaps something that has resolved itself.

Response analysis 500 error breakdown

8. Restart PHP

Finally, you can also try restarting PHP. If you’re a client, you can easily restart PHP from the tools menu within the dashboard. If your host doesn’t provide this, you can always open up a tư vấn ticket & ask them restart PHP.

Restart PHP

9. PHP Timeout Issue

PHP timeouts occur if a single PHP process runs for longer than the max_execution_time or max_input_time phối in the PHP configuration on your server. This is a common occurrence if you’re doing big WordPress imports. When this happens a 502 hệ thống error is usually displayed. If you run into a PHP timeout these values may need khổng lồ be elevated.

You can check with your current host about what values are phối on your server & if they can be increased. On the platform, these values are set lớn 300 seconds (5 minutes) by default. The maximum PHP timeout values available on our platform are based on your current hosting plan.


As you can see there are quite a few things you can bởi vì to troubleshoot & fix a 502 gateway error on your site. Typically this is not on the client-side, but rather an issue with your host. Third-party plugins & themes with bad code or unoptimized queries are also things to watch out for. Was there anything we missed? Perhaps you have another tip on troubleshooting 502 gateway errors. If so, let us know below in the comments.


What Is a 502 Bad Gateway Error?

The 502 Bad Gateway error indicates that the server received an invalid response from an inbound server.

What Causes the 502 Error?

The 502 bad gateway error is typically caused by issues related lớn the network/server, however, it can also be caused by client-side issues.

How vày You Fix the 502 Bad Gateway Error?

There are a number of things you can try when attempting lớn fix the 502 Bad Gateway Error:

1. Try Reloading the Page2. Clear Your Browser Cache3. Flush your local DNS cache4. Check With Your Host5. Temporarily Disable CDN or Firewall6. Check Your Plugins và Themes7. Check Your Logs8. Restart PHP9. PHP Timeout Issue

Get all your applications, databases and WordPress sites online và under one roof. Our feature-packed, high-performance cloud platform includes:

Easy cài đặt and management in the dashboard24/7 expert supportThe best Google Cloud Platform hardware và network, powered by Kubernetes for maximum scalabilityAn enterprise-level Cloudflare integration for speed và securityGlobal audience reach with up khổng lồ 35 data centers and 275+ PoPs worldwide

Test it yourself with $20 off your first month of Application Hosting or Database Hosting. Explore our plans or talk to sales to lớn find your best fit.

hotlive |