{"id":8060,"date":"2018-04-23T12:09:10","date_gmt":"2018-04-23T12:09:10","guid":{"rendered":"https:\/\/www.hostinger.com\/tutorials\/?p=8060"},"modified":"2025-04-25T16:58:12","modified_gmt":"2025-04-25T16:58:12","slug":"502-bad-gateway","status":"publish","type":"post","link":"\/in\/tutorials\/502-bad-gateway","title":{"rendered":"How to Fix the 502 Bad Gateway Error"},"content":{"rendered":"<p>A 502 Bad Gateway Error is a common HTTP status code you can easily troubleshoot.<\/p><p>In this guide, we&rsquo;ll outline ten practical steps to diagnose and fix a 502 Bad Gateway Error for both client-side and server-side issues. We&rsquo;ll explore various potential causes, ensuring you have a comprehensive understanding of what might be going wrong. <\/p><p class=\"has-text-align-center\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/HTTP-Status-Codes-Cheat-Sheet.pdf\" target=\"_blank\" rel=\"noreferrer noopener\">Download comprehensive HTTP status codes cheat sheet<\/a><\/p><p>\n\n\n\n\n\n<div class=\"protip\">\n                    <h2 class=\"featured-snippet title\">What Is a 502 Bad Gateway Error?<\/h2>\n                    <p>A 502 Bad Gateway Error is an HTTP status code showing a communication problem between the two servers on the internet, where the proxy server or gateway server receives an invalid response from the upstream server. In most cases, resolving the 502 error is easy and quick.<\/p>\n                <\/div>\n\n\n\n<figure tabindex=\"0\" class=\"wp-block-table\"><table><tbody><tr><td>Error code<\/td><td>502 Bad Gateway Error<\/td><\/tr><tr><td>Error type<\/td><td>Server-side error<\/td><\/tr><tr><td>Error variations<\/td><td>Temporary Error (502)<br>HTTP Error 502 Bad Gateway<br>502 Proxy Error<br>Bad 502 Gateway<br>502 Service Temporarily Overloaded<br>A blank white screen<\/td><\/tr><tr><td>Error causes<\/td><td>Upstream server issues<br>Proxy server received an invalid response<br>Network communication errors between servers<br>Server overload due to high traffic<br>Faulty browser cache or extensions<br>Incorrect DNS settings<br>Misconfigured firewall or CDN issues<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/in\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/07\/502-Featured-Graph.png\"><img decoding=\"async\" width=\"768\" height=\"274\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2021\/07\/502-Featured-Graph.png\" alt=\"Infographic detailing the 502 bad gateway error\" class=\"wp-image-32717\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2021\/07\/502-Featured-Graph.png 768w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2021\/07\/502-Featured-Graph-300x107.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2021\/07\/502-Featured-Graph-150x54.png 150w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/a><\/figure><\/div><h2 class=\"wp-block-heading\" id=\"h-what-causes-a-502-bad-gateway-error\">What Causes a 502 Bad Gateway Error<\/h2><p>A 502 Bad Gateway error message arises from a communication failure between web servers. It occurs when a server acting as an intermediary receives a response from another server that it can&rsquo;t understand or process. Mainly, there are four 502 Bad Gateway causes:<\/p><ul class=\"wp-block-list\">\n<li><strong>Meaningless response<\/strong> &ndash; the other web server sent back wrong or incomplete data.<\/li>\n\n\n\n<li><strong>Incorrect format<\/strong> &ndash; the response is in the wrong language or technical format for the intermediary server to interpret.<\/li>\n\n\n\n<li><strong>Server overload<\/strong> &ndash; the other server is too busy and unable to respond properly.<\/li>\n\n\n\n<li><strong>Network problems<\/strong> &ndash; glitches in the connection between the servers.<\/li>\n<\/ul><p>These issues prevent the intermediary server from fulfilling your request, resulting in a 502 error.<\/p><h2 class=\"wp-block-heading\" id=\"h-502-bad-gateway-error-variations\">502 Bad Gateway Error Variations<\/h2><p>A 502 error can appear on any device or service, but the exact message might differ. Here are some variations of this <a href=\"\/in\/tutorials\/http-status-codes\">HTTP status code<\/a> you might see:<\/p><ul class=\"wp-block-list\">\n<li><strong>Simple<\/strong> &ndash; Temporary Error (502), 502 Error.<\/li>\n\n\n\n<li><strong>Descriptive<\/strong> &ndash; HTTP Error 502 Bad Gateway, 502 Server Error, with an explanation.<\/li>\n\n\n\n<li><strong>Technical<\/strong> &ndash; 502 &ndash; Web server received an invalid response, HTTP 502, 502 Proxy Error.<\/li>\n\n\n\n<li><strong>Overload<\/strong> &ndash; 502 Service Temporarily Overloaded.<\/li>\n\n\n\n<li><strong>Server-specific<\/strong> &ndash; 502 Bad Gateway Nginx, depending on server software.<\/li>\n\n\n\n<li><strong>Blank screen<\/strong>&ndash; some websites show a plain white screen.<\/li>\n<\/ul><p>Some website owners create unique error pages with additional information. For instance, <strong>Chrome<\/strong> offers troubleshooting tips and suggests retrying.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"\/in\/tutorials\/wp-content\/uploads\/sites\/2\/2018\/04\/google-502-error.png\"><img decoding=\"async\" width=\"1024\" height=\"523\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2018\/04\/google-502-error-1024x523.png\" alt=\"Chrome 502 error page\" class=\"wp-image-31472\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/google-502-error.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/google-502-error-300x153.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/google-502-error-150x77.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/google-502-error-768x392.png 768w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/google-502-error-1536x785.png 1536w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><p><strong>GitLab<\/strong> explains the communication issue and provides solutions.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"\/in\/tutorials\/wp-content\/uploads\/sites\/2\/2018\/04\/gitlab-502-error.png\"><img decoding=\"async\" width=\"1024\" height=\"523\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2018\/04\/gitlab-502-error-1024x523.png\" alt=\"Gitlab 502 error page\" class=\"wp-image-31471\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/gitlab-502-error.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/gitlab-502-error-300x153.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/gitlab-502-error-150x77.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/gitlab-502-error-768x392.png 768w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/gitlab-502-error-1536x785.png 1536w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><p><strong>X (previously Twitter)<\/strong>, on the other hand, displays a friendly message with an illustration.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"\/in\/tutorials\/wp-content\/uploads\/sites\/2\/2018\/04\/twitter-502-error.png\"><img decoding=\"async\" width=\"1024\" height=\"523\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2018\/04\/twitter-502-error-1024x523.png\" alt=\"Twitter\/X 502 error page\" class=\"wp-image-31475\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/twitter-502-error.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/twitter-502-error-300x153.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/twitter-502-error-150x77.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/twitter-502-error-768x392.png 768w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/twitter-502-error-1536x785.png 1536w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><p>\n\n<div class=\"protip\">\n                    <h4 class=\"title\">Improve Your User Experience With Customized Error Pages<\/h4>\n                    <p>We recommend <a href=\"https:\/\/support.hostinger.com\/en\/articles\/1583295-how-to-customize-your-website-s-error-pages\" target=\"_blank\" rel=\"noopener\">customizing your pages with error codes<\/a>. This way, you can improve your user experience by providing helpful content for your visitors. <\/p>\n                <\/div>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-fix-the-502-bad-gateway-error\">How to Fix the 502 Bad Gateway Error<\/h2><p>In most cases, the 502 Bad Gateway error is temporary &ndash; you just have to wait for around 30 seconds for it to disappear. To troubleshoot further, try the following:<\/p><h3 class=\"wp-block-heading\" id=\"h-1-refresh-the-page\">1. Refresh the Page<\/h3><p>Usually, a 502 Bad Gateway Error is temporary, stemming from a sudden traffic surge. A quick refresh can resolve the issue.<\/p><p>On Windows, press <strong>F5<\/strong> or <strong>CTRL + F5.<\/strong> On Mac, use <strong>CMD + R<\/strong>.<\/p><h3 class=\"wp-block-heading\" id=\"h-2-check-the-site-status\">2. Check the Site Status<\/h3><p>If the 502 error code is still showing up, it is possible the website&rsquo;s server might be currently experiencing downtime.<\/p><p>Luckily, there are many tools to examine <a href=\"\/in\/tutorials\/is-this-website-down\">if the site is down<\/a>, including <a href=\"https:\/\/downforeveryoneorjustme.com\/\" target=\"_blank\" rel=\"noopener\">Down for Everyone or Just Me<\/a> and <a href=\"https:\/\/www.isitdownrightnow.com\/\" target=\"_blank\" rel=\"noopener\">IsItDown<\/a>. Simply input your URL and check the status of the website.<\/p><h3 class=\"wp-block-heading\" id=\"h-3-clear-your-browser-cache\">3. Clear Your Browser Cache<\/h3><p>If the invalid response error persists, there is a chance that your browser cache has saved outdated and corrupted files. In this case, <a href=\"\/in\/tutorials\/clear-browser-cache\">clearing the browser cache<\/a> can offer a 502 Bad Gateway fix.<\/p><p>Keep in mind that removing cached files might result in losing important browser data, including bookmarks and setting preferences. To prevent this, simply <a href=\"https:\/\/support.google.com\/chrome\/answer\/10248834\" target=\"_blank\" rel=\"noopener\">export your data<\/a> from the browser and <a href=\"https:\/\/support.google.com\/chrome\/answer\/96816\" target=\"_blank\" rel=\"noopener\">import it back<\/a> after.<\/p><h3 class=\"wp-block-heading\" id=\"h-4-try-in-the-incognito-mode\">4. Try in the Incognito Mode<\/h3><p>Access the website in Incognito mode to determine whether the 502 gateway timeout appears due to a browser-related issue. To open an Incognito window, click on the three-dots button on your browser screen and choose <strong>New Incognito Window<\/strong>.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"\/in\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/03\/chrome-new-incognito-window-highlighted.png\"><img decoding=\"async\" width=\"1024\" height=\"574\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/03\/chrome-new-incognito-window-highlighted-1024x574.png\" alt=\"New incognito window option highlighted in Chrome\" class=\"wp-image-106504\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/03\/chrome-new-incognito-window-highlighted.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/03\/chrome-new-incognito-window-highlighted-300x168.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/03\/chrome-new-incognito-window-highlighted-150x84.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/03\/chrome-new-incognito-window-highlighted-768x430.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><p>If the error doesn&rsquo;t occur in Incognito mode, your browser extension is likely causing the problem.<\/p><p>Try to disable your add-ons or extensions one by one. When you delete the extension causing the error, you should be able to access the website. From our experience, an ad-blocker extension is usually the culprit.<\/p><p>If disabling browser extensions doesn&rsquo;t help, try a different browser. For example, if you&rsquo;re currently on Google Chrome, try using Mozilla Firefox.<\/p><p>If the page works on the new browser, your previous browser might be causing the error. To solve the problem, try deleting and reinstalling your faulty browser.<\/p><h3 class=\"wp-block-heading\" id=\"h-5-flush-the-dns-cache\">5. Flush the DNS Cache<\/h3><p>Other common causes of 502 Bad Gateway are DNS problems, such as incorrect IP addresses and unresponsive DNS servers.<\/p><p>In this case, <a href=\"\/in\/tutorials\/how-to-flush-dns\">flushing your DNS cache<\/a> can be the answer. This method works similarly to clearing your browser&rsquo;s cache. It will remove faulty files from your DNS server.<\/p><p>Consider also temporarily changing your DNS servers. By default, your ISP assigns your DNS servers. However, you can always change it to a third-party server, such as<a href=\"https:\/\/developers.google.com\/speed\/public-dns\/\" target=\"_blank\" rel=\"noopener\"> Google Public DNS<\/a>.<\/p><h3 class=\"wp-block-heading\" id=\"h-6-test-on-another-device\">6. Test on Another Device<\/h3><p>If none of the above 502 error fixes work, test your internet connection on another computer or a mobile device, ideally connected to a different network.<\/p><p>Additionally, try restarting your computer and router. Doing so shows whether the error is related to your networking equipment or if the problem lies elsewhere.<\/p><h3 class=\"wp-block-heading\" id=\"h-7-check-error-logs\">7. Check Error Logs<\/h3><p>If you encounter a website 502 error after a change or an update, you might be dealing with a web server error. The best approach to solving this issue is to <a href=\"\/in\/tutorials\/website\/how-to-check-your-website-error-log\">check your website error log<\/a>.<\/p><p>Usually, <a href=\"\/in\/web-hosting\">your hosting service<\/a> lets you access your website error log files through an admin dashboard. You can also enable error logging on your WordPress website by adding the following lines in <strong>wp-config.php<\/strong>:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">define( 'WP_DEBUG', true ); \ndefine( 'WP_DEBUG_LOG', true ); \ndefine( 'WP_DEBUG_DISPLAY', false );<\/pre><p>All of the generated errors will appear in the<strong> wp-contents\/debug.log<\/strong> file, allowing you to detect which ones are causing a 502 Bad Gateway error.<\/p><h3 class=\"wp-block-heading\" id=\"h-8-check-plugins-and-themes\">8. Check Plugins and Themes<\/h3><p>Sometimes, faulty plugins or themes can cause the error.<\/p><p>This is because poorly coded plugins and themes can conflict with each other. When this happens, your server will stop every script and query on your website, making it inaccessible.<\/p><p>For some websites, the issue usually comes from caching or security plugins. There is a good chance that these plugins block communication between servers, causing the error to persist.<\/p><p>If you don&rsquo;t have a caching or security plugin installed but still encounter the HTTP 502 error, it&rsquo;s best to disable your plugins and re-activate them one by one. To do so, go to <strong>Plugins<\/strong> and simply click <strong>Deactivate<\/strong> from the <strong>Bulk Actions<\/strong> menu.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"\/in\/tutorials\/wp-content\/uploads\/sites\/2\/2018\/04\/wordpress-plugins-deactivate.png\"><img decoding=\"async\" width=\"1024\" height=\"449\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2018\/04\/wordpress-plugins-deactivate-1024x449.png\" alt=\"Plugins menu in WordPress with deactivate section highlighted\" class=\"wp-image-31476\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/wordpress-plugins-deactivate-1024x449.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/wordpress-plugins-deactivate-300x131.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/wordpress-plugins-deactivate-150x66.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/wordpress-plugins-deactivate-768x336.png 768w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/wordpress-plugins-deactivate-1536x673.png 1536w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/wordpress-plugins-deactivate.png 1972w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><p>Then, activate each plugin while refreshing your WordPress site after each one. Once the 502 error pops up again, you have found the problem plugin.<\/p><p>However, if you can&rsquo;t access your WordPress dashboard, you can try disabling them from your hosting panel or FTP program. Navigate to the <strong>wp-content<\/strong> directory and rename the plugins directory, for example, <strong>plugins-disable<\/strong>.<\/p><p>If you use Hostinger, access your <strong>hPanel<\/strong> and click on <strong>Files<\/strong>. From there, go to <strong>File Manager &rarr; public_html &rarr; wp-content. <\/strong> <\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/in\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-publichtml-wpcontent-plugins-rename.png\"><img decoding=\"async\" width=\"599\" height=\"366\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/filemanager-publichtml-wpcontent-plugins-rename.png\" alt=\"Plugin rename pop up close up in File Manager\" class=\"wp-image-80669\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2023\/03\/filemanager-publichtml-wpcontent-plugins-rename.png 599w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2023\/03\/filemanager-publichtml-wpcontent-plugins-rename-300x183.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2023\/03\/filemanager-publichtml-wpcontent-plugins-rename-150x92.png 150w\" sizes=\"(max-width: 599px) 100vw, 599px\" \/><\/a><\/figure><\/div><p>Once your site starts working after all plugins are disabled, you may rename the folder back to <strong>plugins<\/strong>. Then, try enabling the plugins one by one to determine which one caused the error in the first place.<\/p><p>If the website still doesn&rsquo;t work, follow the same steps with your WordPress themes.<\/p><h3 class=\"wp-block-heading\" id=\"h-9-check-your-content-delivery-network-cdn\">9. Check Your Content Delivery Network (CDN)<\/h3><p>Another cause of the 502 Bad Gateway errors can be issues with your <a href=\"\/in\/tutorials\/what-is-cdn\">content delivery network (CDN)<\/a> or <strong>DDoS<\/strong> mitigation services.<\/p><p>A CDN adds an extra layer between your server and browser to deliver web content efficiently. However, this layer can run into an issue when connecting with your origin server, resulting in 502 Errors.<\/p><p>One notable example is <strong>Cloudflare<\/strong>, where the 502 Bad Gateway can occur in two different variations depending on the issue.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"\/in\/tutorials\/wp-content\/uploads\/sites\/2\/2018\/04\/cloudflare-nginx-502.png\"><img decoding=\"async\" width=\"1024\" height=\"523\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2018\/04\/cloudflare-nginx-502-1024x523.png\" alt=\"Cloudflare bad gateway error\" class=\"wp-image-31470\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/cloudflare-nginx-502.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/cloudflare-nginx-502-300x153.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/cloudflare-nginx-502-150x77.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/cloudflare-nginx-502-768x392.png 768w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/cloudflare-nginx-502-1536x785.png 1536w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><p>The screen above indicates that the issue is on Cloudflare&rsquo;s side. To fix it, you&rsquo;ll need to reach out to their customer support team. Remember to check the<a href=\"https:\/\/www.cloudflarestatus.com\/\" target=\"_blank\" rel=\"noopener\"> Cloudflare System Status<\/a> page before doing so.<\/p><p>Alternatively, you can disable Cloudflare. However, keep in mind that your DNS propagation may take a couple of hours.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"\/in\/tutorials\/wp-content\/uploads\/sites\/2\/2018\/04\/502-error-bad-gateway.png\"><img decoding=\"async\" width=\"1024\" height=\"523\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2018\/04\/502-error-bad-gateway-1024x523.png\" alt=\"502 error resulting from web hosting side\" class=\"wp-image-31468\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/502-error-bad-gateway.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/502-error-bad-gateway-300x153.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/502-error-bad-gateway-150x77.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/502-error-bad-gateway-768x392.png 768w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2018\/04\/502-error-bad-gateway-1536x785.png 1536w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><p>If you see the Cloudflare error shown above, it means that the issue lies with your current web hosting provider. In this case, try to contact your web host support team and ask for assistance.<\/p><h3 class=\"wp-block-heading\" id=\"h-10-increase-php-max-execution-time-and-max-input-time\">10. Increase PHP max_execution_time and max_input_time<\/h3><p>PHP timeout happens whenever a PHP process loads for more than the specified <strong>max_execution_time <\/strong>or<strong> max_input_time<\/strong>. These are the values set in your PHP configurations on your web server. Usually, the values are set to <strong>300 seconds<\/strong> by default.<\/p><p>A timeout can happen during the migration process and trigger a 502 Bad Gateway error. To fix this issue, you can contact customer support of your hosting provider to check what your values are set at and if you can increase them.<\/p><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-full\"><a href=\"\/in\/web-hosting\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\" alt=\"Hostinger web hosting banner\" class=\"wp-image-98604\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2023\/11\/Web-hosting_in-text-banner.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2023\/11\/Web-hosting_in-text-banner-300x88.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2023\/11\/Web-hosting_in-text-banner-150x44.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2023\/11\/Web-hosting_in-text-banner-768x225.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h2 class=\"wp-block-heading\" id=\"h-how-to-fix-502-bad-gateway-error-video-tutorial\">How to Fix 502 Bad Gateway Error &ndash; Video Tutorial<\/h2><p>If you prefer to follow along with a video tutorial, check out this <a href=\"https:\/\/www.youtube.com\/HostingerAcademy\" target=\"_blank\" rel=\"noopener\">Hostinger Academy<\/a> guide on how to solve this generic error:<\/p><figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"How to Fix 502 Bad Gateway Error\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/T15thZb4TXg?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure><p>\n\n\n\n  <div class=\"youtube-shortcode\">\n    <div class=\"row\">\n      <div class=\"col-7 col-sm-8 d-flex align-items-center\">\n        <img decoding=\"async\" class=\"channel-logo\" src=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/themes\/tutorialsthemeuplift\/public\/images\/youtube-channels\/hostinger-academy.jpg\" alt=\"youtube channel logo\">\n        <div class=\"d-flex flex-column justify-content-between\">\n          <span class=\"slogan d-none d-sm-block\">Subscribe For more educational videos!<\/span>\n          <span class=\"channel-name\">Hostinger Academy<\/span>\n                    <\/div>\n      <\/div>\n      <div class=\"col-5 col-sm-4 d-flex align-items-center justify-content-end\">\n          <a class=\"subscribe-button\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" href=\"http:\/\/www.youtube.com\/channel\/UCbNIC-svDbtUOH2qsLnPQPg?sub_confirmation=1\">\n            <img decoding=\"async\" src=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/themes\/tutorialsthemeuplift\/public\/images\/icons\/youtube.svg\" alt=\"subscribe\">\n            <span>Subscribe<\/span>\n          <\/a>\n      <\/div>\n    <\/div>\n  <\/div>\n\n    \n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>Encountering a 502 Bad Gateway Error can be annoying, yet it&rsquo;s a common issue that stems from a communication error between servers.<\/p><p>There are many reasons for this error, including server misconfiguration, overloads, software bugs, and network issues.<\/p><p>To resolve a 502 network error, refresh the page, check server configurations, ensure network stability, flush the DNS cache, or check for widespread downtime.<\/p><h2 class=\"wp-block-heading\" id=\"h-502-bad-gateway-faq\">502 Bad Gateway FAQ<\/h2><p>Find answers to some of the most common questions on the 502 Bad Gateway error below. <\/p><div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1711499872672\"><h3 class=\"schema-faq-question\">Is 502 Bad Gateway Permanent?<\/h3> <p class=\"schema-faq-answer\">No, the 502 Bad Gateway error is usually temporary. It can occur due to temporary issues, such as errors in server-side code or DNS problems. You can usually solve the issue by refreshing the page or waiting a few minutes. Even though it&rsquo;s a server-side error, the 502 Bad Gateway message might appear due to client-side factors like cache or DNS settings.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1711499888740\"><h3 class=\"schema-faq-question\">Is 502 Bad Gateway a Hack?<\/h3> <p class=\"schema-faq-answer\">A 502 Bad Gateway error doesn&rsquo;t typically indicate a hack. It&rsquo;s more often a sign of server communication issues, such as when a proxy server receives an invalid response from an upstream server. While it&rsquo;s possible for malicious activity to lead to server errors, a 502 error on its own does not suggest hacking or security breaches.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1711499899228\"><h3 class=\"schema-faq-question\">Does 502 Bad Gateway Error Affect SEO?<\/h3> <p class=\"schema-faq-answer\">Yes, a 502 Bad Gateway error can affect <a href=\"\/in\/tutorials\/what-is-seo\/\">search engine optimization (SEO)<\/a> if it persists for a long time. Search engines like Google aim to provide users with a good experience, and inaccessible pages due to server errors can negatively impact a site&rsquo;s ranking. It&rsquo;s crucial to resolve these errors promptly to minimize any potential SEO impact.<\/p> <\/div> <\/div><p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A 502 Bad Gateway Error is a common HTTP status code you can easily troubleshoot. In this guide, we&rsquo;ll outline ten practical steps to diagnose and fix a 502 Bad Gateway Error for both client-side and server-side issues. We&rsquo;ll explore various potential causes, ensuring you have a comprehensive understanding of what might be going wrong. [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/in\/tutorials\/502-bad-gateway\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":180,"featured_media":101568,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"","rank_math_description":"","rank_math_focus_keyword":"","footnotes":""},"categories":[],"tags":[],"class_list":["post-8060","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/how-to-fix-502-bad-gateway-error","default":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/corrigir-erro-502-bad-gateway","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/tutoriels\/erreur-502-bad-gateway","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/solucionar-error-502-bad-gateway","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/tutorial\/502-bad-gateway","default":0},{"locale":"de-DE","link":"https:\/\/www.hostinger.com\/de\/tutorials\/502-bad-gateway","default":0},{"locale":"it-IT","link":"https:\/\/www.hostinger.com\/it\/tutorial\/errore-502-bad-gateway","default":0},{"locale":"nl-NL","link":"https:\/\/www.hostinger.com\/nl\/tutorials\/502-bad-gateway","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/502-bad-gateway","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/502-bad-gateway","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/502-bad-gateway","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/agregar-meta-descripcion-wordpress-4","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/agregar-meta-descripcion-wordpress-4","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/como-hacer-un-blog-de-viajes-20\/","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/melhores-plataformas-de-ecommerce-6","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/502-bad-gateway","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/how-to-fix-502-bad-gateway-error","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/how-to-fix-502-bad-gateway-error","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/how-to-fix-502-bad-gateway-error","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts\/8060","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/users\/180"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/comments?post=8060"}],"version-history":[{"count":79,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts\/8060\/revisions"}],"predecessor-version":[{"id":110960,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts\/8060\/revisions\/110960"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/media\/101568"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/media?parent=8060"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/categories?post=8060"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/tags?post=8060"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}