{"id":2932,"date":"2019-10-23T17:20:13","date_gmt":"2019-10-23T09:20:13","guid":{"rendered":"https:\/\/www.mondoze.com\/guide\/?post_type=kb&#038;p=2932"},"modified":"2022-10-05T08:00:31","modified_gmt":"2022-10-05T00:00:31","slug":"what-should-i-do-after-seeing-a-502-or-504-gateway-error-on-my-site","status":"publish","type":"kb","link":"https:\/\/www.mondoze.com\/guide\/kb\/what-should-i-do-after-seeing-a-502-or-504-gateway-error-on-my-site","title":{"rendered":"What should I do after seeing a 502 or 504 gateway error on my site?"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"2932\" class=\"elementor elementor-2932\" data-elementor-settings=\"[]\">\n\t\t\t\t\t\t<div class=\"elementor-inner\">\n\t\t\t\t\t\t\t<div class=\"elementor-section-wrap\">\n\t\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-127c3e19 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"127c3e19\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-6e964064\" data-id=\"6e964064\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-9ca5eff elementor-widget elementor-widget-heading\" data-id=\"9ca5eff\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">502 and 504 Gateway Error<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-45a13e38 elementor-widget elementor-widget-text-editor\" data-id=\"45a13e38\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<p>The 502 and 504 errors are quite similar. They are caused by a problem connecting to an upstream server &#8211; meaning. Your server is trying to initiate a process and this fails to work as expected or times out.\u00a0<\/p><p>In most cases of 502 \/ 504 errors, back-end servers are not communicating correctly. There are three reasons this can occur:<\/p><ol><li>Origin Server is not configured to handle the requested domain name at the targeted IP address. Maybe caused when changing DNS records; keep in mind DNS TTL determines how long a record is valid in DNS cache.<\/li><li>The server at the origin is overloaded or unreachable at the time the request was made. The could be due to the server crashing, traffic spikes, or lack of connectivity to the server.<\/li><li>An application or service used at your origin with is either timing out or being blocked.<\/li><\/ol><p>Generally, a HTTP 502 or 504 errors occurs because your origin server (e.g. your web host) is returning this code to us, and Cloudflare returns this code in turn to your visitors.<\/p><p>When this happens you will see an error with the Cloudflare branding:<\/p><p><strong> <img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-2933\" src=\"https:\/\/www.mondoze.com\/guide\/wp-content\/uploads\/2021\/03\/err1-300x208.png\" alt=\"\" width=\"300\" height=\"208\" \/> <img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-2934\" src=\"https:\/\/www.mondoze.com\/guide\/wp-content\/uploads\/2021\/03\/err2-300x167.png\" alt=\"\" width=\"300\" height=\"167\" \/><\/strong><\/p><p>In this case, and you should contact your hosting provider for further troubleshooting or review your own logs if you manage the server yourself.<\/p><p>Note that 502s and 504s can be returned by any HTTP-aware device. If you have any load\u00a0balancers or local proxies in place and do not see errors in the logs of the server that handles that page, check other infrastructure between your origin and Cloudflare.<\/p><p>You should be able to verify that by generating a HAR file &#8211; How do I generate a HAR file?<\/p><p>In that case, the error page will look specifically like this:<\/p><p><strong><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-2934\" src=\"https:\/\/www.mondoze.com\/guide\/wp-content\/uploads\/2021\/03\/err2-300x167.png\" alt=\"\" width=\"300\" height=\"167\" \/><\/strong><\/p><p>Note that the name \u201ccloudflare\u201d appears at the bottom of the error message. If you do not see this, then this error is *not* coming from Cloudflare, and instead is coming from your origin server.<\/p><p>If you do see \u201ccloudflare\u201d in the error page, please run a traceroute from your machine to your domain, and point your browser to \u201chttp:\/\/example.com\/cdn-cgi\/trace\u201d\u00a0(replace example.com with your actual site). Then open a support ticket and copy-paste both the traceroute result and the information shown in your browser.<\/p><p>As mentioned previously, most of the time these error codes are actually coming from your origin web server. It might look like the screenshot below, but depending on the web server you run and the amount of\u00a0customisation\u00a0you have done, it may look completely different as well.<\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>502 and 504 Gateway Error The 502 and 504 errors are quite similar. They are caused by a problem connecting to an upstream server &#8211; meaning. Your server is trying to initiate a process and this fails to work as expected or times out.\u00a0 In most cases of 502 \/ 504 errors, back-end servers are &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/www.mondoze.com\/guide\/kb\/what-should-i-do-after-seeing-a-502-or-504-gateway-error-on-my-site\"> <span class=\"screen-reader-text\">What should I do after seeing a 502 or 504 gateway error on my site?<\/span> Read More \u00bb<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}}},"kbtopic":[53],"kbtag":[110],"mkb_version":[],"_links":{"self":[{"href":"https:\/\/www.mondoze.com\/guide\/wp-json\/wp\/v2\/kb\/2932"}],"collection":[{"href":"https:\/\/www.mondoze.com\/guide\/wp-json\/wp\/v2\/kb"}],"about":[{"href":"https:\/\/www.mondoze.com\/guide\/wp-json\/wp\/v2\/types\/kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.mondoze.com\/guide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mondoze.com\/guide\/wp-json\/wp\/v2\/comments?post=2932"}],"version-history":[{"count":8,"href":"https:\/\/www.mondoze.com\/guide\/wp-json\/wp\/v2\/kb\/2932\/revisions"}],"predecessor-version":[{"id":18287,"href":"https:\/\/www.mondoze.com\/guide\/wp-json\/wp\/v2\/kb\/2932\/revisions\/18287"}],"wp:attachment":[{"href":"https:\/\/www.mondoze.com\/guide\/wp-json\/wp\/v2\/media?parent=2932"}],"wp:term":[{"taxonomy":"kbtopic","embeddable":true,"href":"https:\/\/www.mondoze.com\/guide\/wp-json\/wp\/v2\/kbtopic?post=2932"},{"taxonomy":"kbtag","embeddable":true,"href":"https:\/\/www.mondoze.com\/guide\/wp-json\/wp\/v2\/kbtag?post=2932"},{"taxonomy":"mkb_version","embeddable":true,"href":"https:\/\/www.mondoze.com\/guide\/wp-json\/wp\/v2\/mkb_version?post=2932"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}