{"id":34323,"date":"2021-10-14T17:13:59","date_gmt":"2021-10-14T17:13:59","guid":{"rendered":"https:\/\/www.hostduplex.com\/kb\/?post_type=ht_kb&#038;p=34323"},"modified":"2021-10-16T07:23:12","modified_gmt":"2021-10-16T07:23:12","slug":"502-bad-gateway","status":"publish","type":"ht_kb","link":"https:\/\/www.hostduplex.com\/kb\/article\/502-bad-gateway\/","title":{"rendered":"How to fix a 502 Bad Gateway error on your WordPress site"},"content":{"rendered":"\n<p>Every time you visit a website your browser sends a request to a web server. The web server receives and processes the request, and then sends back the requested resources along with an HTTP header and&nbsp;HTTP status code. The 502 Bad Gateway error specifically means that the server&nbsp;received an invalid response&nbsp;from an inbound server.<\/p>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-danger\">The 502 Bad Gateway error can affect your website&#8217;s SEO rankings if not fixed within a period of 5 or 6 hours.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Variations<a href=\"https:\/\/kinsta.com\/blog\/502-bad-gateway\/#502-bad-gateway-error-variations\" target=\"_blank\" rel=\"noopener\"><\/a><\/h4>\n\n\n\n<p>The 502 Bad Gateway error can look different depending on the browser, web servers and OS you&#8217;re using. Here are some of the variations you may have encountered:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>502 Bad Gateway<\/li><li>Error 502<\/li><li>HTTP Error 502 \u2013 Bad Gateway<\/li><li>502 Service Temporarily Overloaded<\/li><li>502 Proxy Error<\/li><li>A blank white screen<\/li><li>502 Server Error: The server encountered a temporary error and could not complete your request<\/li><li>HTTP 502<\/li><li>Temporary Error (502)<\/li><\/ul>\n\n\n\n<p> Regardless of this, the 502 bad gateway error always has the same meaning.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-fix-the-502-bad-gateway-error\">How to fix it?<a href=\"https:\/\/kinsta.com\/blog\/502-bad-gateway\/#how-to-fix-the-502-bad-gateway-error\" target=\"_blank\" rel=\"noopener\"><\/a><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"1-try-reloading-the-page\">1. Try reloading the page<a href=\"https:\/\/kinsta.com\/blog\/502-bad-gateway\/#1-try-reloading-the-page\" target=\"_blank\" rel=\"noopener\"><\/a><\/h3>\n\n\n\n<p>Let&#8217;s begin by ruling out the simplest and most common causes. More often than not, the 502 gateway error shows up due to an overloaded server. If this is the case, then the issue will resolve itself in a matter of minutes and all you have to do is wait and refresh the page.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"2-clear-your-browser-cache\">2. Clear your browser cache or use a different one<a href=\"https:\/\/kinsta.com\/blog\/502-bad-gateway\/#2-clear-your-browser-cache\" target=\"_blank\" rel=\"noopener\"><\/a><\/h3>\n\n\n\n<p>A 502 bad gateway error can also be a client-side issue. We recommend clearing your cache or visiting your website using another browser just to be sure it is down for everyone and not just you.<\/p>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-info\">There are a multitude of online tools that can help you determine if your site is down or if the problem is on your side. One of them is <a href=\"http:\/\/downforeveryoneorjustme.com\" target=\"_blank\" rel=\"noopener\">downforeveryoneorjustme.com<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><a rel=\"noreferrer noopener\" target=\"_blank\" href=\"https:\/\/kinsta.com\/legal\/privacy-policy\/\"><\/a>3.&nbsp;Clear your local DNS cache<a href=\"https:\/\/kinsta.com\/blog\/502-bad-gateway\/#3-dns-issue\" target=\"_blank\" rel=\"noopener\"><\/a><\/h3>\n\n\n\n<p>Maybe the domain is not resolving to the correct IP, or the&nbsp;DNS server is not responding. If you just migrated your website to a new host, it is possible the DNS hasn&#8217;t fully propagated.<\/p>\n\n\n\n<p>Related: <a href=\"https:\/\/www.hostduplex.com\/kb\/article\/dns-propagation\/\">What is DNS propagation?<\/a><\/p>\n\n\n\n<p>You can also try&nbsp;clearing your local DNS cache. If you are using Windows, open the Command Prompt and enter the following code:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ipconfig&nbsp;\/flushdns<\/pre>\n\n\n\n<p>You&#8217;ll see a \u201cSuccessfully flushed the DNS&nbsp;resolver&nbsp;cache\u201d once the process is done.<\/p>\n\n\n\n<p>If you are a macOS user, enter the following code in the terminal:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">dscacheutil -flushcache<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"4-check-with-your-host\">4. Contact your hosting provider<a href=\"https:\/\/kinsta.com\/blog\/502-bad-gateway\/#4-check-with-your-host\" target=\"_blank\" rel=\"noopener\"><\/a><\/h3>\n\n\n\n<p>Your hosting provider may have lost connection to the server. They could also be doing server maintenance. Regardless of the reason, we recommend you open a ticket or get in touch with them just to make sure that they are aware and working on the issue. <\/p>\n\n\n\n<p>If they have access to the server and everything seems to be working just fine, they could still provide further assistance by having experts look into the problem.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"5-temporarily-disable-cdn-or-firewall\">5. Temporarily Disable CDN or Firewall<a href=\"https:\/\/kinsta.com\/blog\/502-bad-gateway\/#5-temporarily-disable-cdn-or-firewall\" target=\"_blank\" rel=\"noopener\"><\/a><\/h3>\n\n\n\n<p>The error can also be caused by your&nbsp;content delivery network&nbsp;(CDN) or&nbsp;firewall. If you are using a 3rd-party CDN provider, you can try disabling your CDN temporarily and checking your website again.<\/p>\n\n\n\n<p>This can also occur sometimes with&nbsp;<a href=\"https:\/\/kinsta.com\/blog\/what-is-a-ddos-attack\/\" target=\"_blank\" rel=\"noopener\">DDoS protection<\/a> providers&nbsp;like Cloudflare. If you&#8217;re currently using Cloudflare, you may be seeing one of the screens pictured below. They both mean different things and can give you an indication of where the problem originated.<\/p>\n\n\n\n<p>The following screen indicates an issue on Cloudflare&#8217;s end. You can reach out to them through their support channels, but it might be quicker to check&nbsp;their status page&nbsp;or social media profiles to see if they&#8217;re experiencing an outage.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"900\" height=\"500\" src=\"https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/image5.png\" alt=\"\" class=\"wp-image-34324\" srcset=\"https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/image5.png 900w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/image5-300x167.png 300w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/image5-768x427.png 768w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/image5-50x28.png 50w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/image5-60x33.png 60w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/image5-100x56.png 100w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/figure>\n\n\n\n<p><a href=\"https:\/\/kinsta.com\/blog\/502-bad-gateway\/#502-bad-gateway-at-cloudflare-variation-2\" target=\"_blank\" rel=\"noopener\"><\/a>However, if you see the following screen, this indicates a problem with your hosting provider.<a href=\"https:\/\/kinsta.com\/blog\/502-bad-gateway\/#godaddy-firewall\" target=\"_blank\" rel=\"noopener\"><\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"922\" height=\"640\" src=\"https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/image1.png\" alt=\"\" class=\"wp-image-34325\" srcset=\"https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/image1.png 922w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/image1-300x208.png 300w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/image1-768x533.png 768w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/image1-50x35.png 50w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/image1-60x42.png 60w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/image1-100x69.png 100w\" sizes=\"auto, (max-width: 922px) 100vw, 922px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"6-check-your-plugins-and-themes\">6. Check your plugins and themes<a href=\"https:\/\/kinsta.com\/blog\/502-bad-gateway\/#6-check-your-plugins-and-themes\" target=\"_blank\" rel=\"noopener\"><\/a><\/h3>\n\n\n\n<p>If you recently installed a plugin or a new theme on your WordPress, snippets of bad code could be the culprit here. A few ways you can troubleshoot this is by deactivating all your plugins or switching your theme. You won&#8217;t lose any data by doing this.<\/p>\n\n\n\n<p>If you can still&nbsp;access your administrator dashboard, you can manage your plugins by navigating to the Plugins section using the left sidebar. You can begin by disabling the ones you suspect could be causing the problem and continuosly checking your website to see if it starts working.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"473\" src=\"https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/pluginsfull-1024x473.png\" alt=\"\" class=\"wp-image-34328\" srcset=\"https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/pluginsfull-1024x473.png 1024w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/pluginsfull-300x139.png 300w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/pluginsfull-768x355.png 768w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/pluginsfull-50x23.png 50w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/pluginsfull-60x28.png 60w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/pluginsfull-100x46.png 100w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/pluginsfull.png 1313w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>If you can\u2019t access your WordPress dashboard, try using FileZilla or another FTP client to connect to your server and rename your plugins folder. Then check your site again. If it works, then you will need to test each plugin one by one. Rename your plugin folder back to &#8220;plugins&#8221; and then rename each plugin folder inside of it, one by one, until you find the one that&#8217;s causing the issue.<\/p>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-info\">The plugins folder is typically found on \/public_html\/wp-content<\/p>\n\n\n\n<p>Related: <a href=\"https:\/\/www.hostduplex.com\/kb\/article\/what-is-filezilla\/\">What is FileZilla? How do I connect to my account using FileZilla?<\/a><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"606\" src=\"https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/filezilla-plugin-1024x606.png\" alt=\"\" class=\"wp-image-34329\" srcset=\"https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/filezilla-plugin-1024x606.png 1024w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/filezilla-plugin-300x178.png 300w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/filezilla-plugin-768x455.png 768w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/filezilla-plugin-50x30.png 50w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/filezilla-plugin-60x36.png 60w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/filezilla-plugin-100x59.png 100w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/filezilla-plugin.png 1035w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<p>For themes, go to Appearance &#8211;&gt; Themes. There you can see the themes you have installed. Try switching the one you&#8217;re currently using on your website.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"547\" src=\"https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/themes-3-1024x547.png\" alt=\"\" class=\"wp-image-34326\" srcset=\"https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/themes-3-1024x547.png 1024w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/themes-3-300x160.png 300w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/themes-3-768x410.png 768w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/themes-3-50x27.png 50w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/themes-3-60x32.png 60w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/themes-3-100x53.png 100w, https:\/\/www.hostduplex.com\/kb\/wp-content\/uploads\/2021\/10\/themes-3.png 1445w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"9-php-timeout-issue\">7. Increase your PHP timeout values<a href=\"https:\/\/kinsta.com\/blog\/502-bad-gateway\/#9-php-timeout-issue\" target=\"_blank\" rel=\"noopener\"><\/a><\/h3>\n\n\n\n<p>PHP timeouts occur if a single PHP process runs for longer than the&nbsp;<code>max_execution_time<\/code>&nbsp;or&nbsp;<code>max_input_time<\/code>&nbsp;set in the PHP configuration on your server.&nbsp; If you run into a PHP timeout these values may need to be elevated.<\/p>\n\n\n\n<p>You can check with your host what values are set on your server and&nbsp;if they can be increased as part of your current plan.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-text-color has-background has-purple-background-color has-purple-color is-style-default\"\/>\n\n\n\n<p>If you are a Host Duplex customer and still have questions, please open a ticket in the&nbsp;<a href=\"https:\/\/secure.hostduplex.com\/clientarea.php\" target=\"_blank\" rel=\"noopener\">Host Duplex client portal.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Every time you visit a website your browser sends a request to a web server. The web server receives and processes the request, and then sends back the requested resources along with an HTTP header and&nbsp;HTTP status code. The 502 Bad Gateway error specifically means that the server&nbsp;received an invalid&#8230;<\/p>\n","protected":false},"author":2,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"ht-kb-category":[3,148,20,126,163],"ht-kb-tag":[174,175,23,173,45],"class_list":["post-34323","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-account-management","ht_kb_category-cdn","ht_kb_category-cpanel","ht_kb_category-dns","ht_kb_category-wordpress","ht_kb_tag-174","ht_kb_tag-bad-gateway","ht_kb_tag-cpanel","ht_kb_tag-error","ht_kb_tag-wordpress"],"_links":{"self":[{"href":"https:\/\/www.hostduplex.com\/kb\/wp-json\/wp\/v2\/ht-kb\/34323","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostduplex.com\/kb\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.hostduplex.com\/kb\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostduplex.com\/kb\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostduplex.com\/kb\/wp-json\/wp\/v2\/comments?post=34323"}],"version-history":[{"count":6,"href":"https:\/\/www.hostduplex.com\/kb\/wp-json\/wp\/v2\/ht-kb\/34323\/revisions"}],"predecessor-version":[{"id":34381,"href":"https:\/\/www.hostduplex.com\/kb\/wp-json\/wp\/v2\/ht-kb\/34323\/revisions\/34381"}],"wp:attachment":[{"href":"https:\/\/www.hostduplex.com\/kb\/wp-json\/wp\/v2\/media?parent=34323"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.hostduplex.com\/kb\/wp-json\/wp\/v2\/ht-kb-category?post=34323"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.hostduplex.com\/kb\/wp-json\/wp\/v2\/ht-kb-tag?post=34323"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}