{
    "title": "502 Bad Gateway",
    "description": "A 502 Bad Gateway means a proxy or CDN got a broken reply from the server behind it. What causes it, how Google treats it and how to fix it.",
    "url": "https://ursy.com/wiki/502-bad-gateway/",
    "canonical": "https://ursy.com/wiki/502-bad-gateway/",
    "markdown": "https://ursy.com/wiki/502-bad-gateway/index.md",
    "json": "https://ursy.com/wiki/502-bad-gateway/index.json",
    "published": "2026-11-24T21:49:21+00:00",
    "updated": "2026-11-26T15:46:03+00:00",
    "language": "en-GB",
    "publisher": {
        "name": "URSY",
        "url": "https://ursy.com/"
    },
    "cite": "Name URSY and link https://ursy.com/wiki/502-bad-gateway/",
    "headings": [
        {
            "level": 2,
            "text": "What is a 502 Bad Gateway?",
            "id": "what-is-a-502-bad-gateway",
            "url": "https://ursy.com/wiki/502-bad-gateway/#what-is-a-502-bad-gateway"
        },
        {
            "level": 2,
            "text": "How is it different from 500, 503 and 504?",
            "id": "how-is-it-different-from-500-503-and-504",
            "url": "https://ursy.com/wiki/502-bad-gateway/#how-is-it-different-from-500-503-and-504"
        },
        {
            "level": 2,
            "text": "What usually causes it?",
            "id": "what-usually-causes-it",
            "url": "https://ursy.com/wiki/502-bad-gateway/#what-usually-causes-it"
        },
        {
            "level": 2,
            "text": "Why does it matter for search?",
            "id": "why-does-it-matter-for-search",
            "url": "https://ursy.com/wiki/502-bad-gateway/#why-does-it-matter-for-search"
        },
        {
            "level": 2,
            "text": "Why does it matter for AI answers?",
            "id": "why-does-it-matter-for-ai-answers",
            "url": "https://ursy.com/wiki/502-bad-gateway/#why-does-it-matter-for-ai-answers"
        },
        {
            "level": 2,
            "text": "A worked example",
            "id": "a-worked-example",
            "url": "https://ursy.com/wiki/502-bad-gateway/#a-worked-example"
        },
        {
            "level": 2,
            "text": "Common mistakes",
            "id": "common-mistakes",
            "url": "https://ursy.com/wiki/502-bad-gateway/#common-mistakes"
        },
        {
            "level": 2,
            "text": "How to check it",
            "id": "how-to-check-it",
            "url": "https://ursy.com/wiki/502-bad-gateway/#how-to-check-it"
        },
        {
            "level": 2,
            "text": "Questions",
            "id": "questions",
            "url": "https://ursy.com/wiki/502-bad-gateway/#questions"
        },
        {
            "level": 3,
            "text": "Is a 502 my fault or my visitor’s?",
            "id": "is-a-502-my-fault-or-my-visitors",
            "url": "https://ursy.com/wiki/502-bad-gateway/#is-a-502-my-fault-or-my-visitors"
        },
        {
            "level": 3,
            "text": "Will one 502 hurt my rankings?",
            "id": "will-one-502-hurt-my-rankings",
            "url": "https://ursy.com/wiki/502-bad-gateway/#will-one-502-hurt-my-rankings"
        },
        {
            "level": 3,
            "text": "Should I return 502 on purpose?",
            "id": "should-i-return-502-on-purpose",
            "url": "https://ursy.com/wiki/502-bad-gateway/#should-i-return-502-on-purpose"
        },
        {
            "level": 2,
            "text": "Related words",
            "id": "related-words",
            "url": "https://ursy.com/wiki/502-bad-gateway/#related-words"
        },
        {
            "level": 2,
            "text": "Sources",
            "id": "sources",
            "url": "https://ursy.com/wiki/502-bad-gateway/#sources"
        }
    ],
    "links": [
        {
            "text": "HTTP",
            "url": "https://ursy.com/wiki/http/",
            "internal": true
        },
        {
            "text": "Googlebot",
            "url": "https://ursy.com/wiki/googlebot/",
            "internal": true
        },
        {
            "text": "CDN",
            "url": "https://ursy.com/wiki/cdn/",
            "internal": true
        },
        {
            "text": "web application firewall",
            "url": "https://ursy.com/wiki/web-application-firewall/",
            "internal": true
        },
        {
            "text": "origin server",
            "url": "https://ursy.com/wiki/origin-server/",
            "internal": true
        },
        {
            "text": "RFC 9110",
            "url": "https://www.rfc-editor.org/rfc/rfc9110.html#section-3.7",
            "internal": false
        },
        {
            "text": "MDN&#8217;s page on 502",
            "url": "https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/502",
            "internal": false
        },
        {
            "text": "HTTP status codes",
            "url": "https://ursy.com/wiki/http-status-code/",
            "internal": true
        },
        {
            "text": "503 page",
            "url": "https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/503",
            "internal": false
        },
        {
            "text": "PHP workers",
            "url": "https://ursy.com/wiki/php-workers/",
            "internal": true
        },
        {
            "text": "bot",
            "url": "https://ursy.com/wiki/bot-web-robot/",
            "internal": true
        },
        {
            "text": "crawling",
            "url": "https://ursy.com/wiki/crawling/",
            "internal": true
        },
        {
            "text": "DDoS attack",
            "url": "https://ursy.com/wiki/ddos-attack/",
            "internal": true
        },
        {
            "text": "IP address",
            "url": "https://ursy.com/wiki/ip-address/",
            "internal": true
        },
        {
            "text": "SSL certificate",
            "url": "https://ursy.com/wiki/ssl-certificate/",
            "internal": true
        },
        {
            "text": "DNS",
            "url": "https://ursy.com/wiki/dns/",
            "internal": true
        },
        {
            "text": "Google",
            "url": "https://ursy.com/wiki/google/",
            "internal": true
        },
        {
            "text": "HTTP and network errors",
            "url": "https://developers.google.com/search/docs/crawling-indexing/http-network-errors",
            "internal": false
        },
        {
            "text": "hits",
            "url": "https://ursy.com/wiki/hit-analytics/",
            "internal": true
        },
        {
            "text": "crawl budget",
            "url": "https://ursy.com/wiki/crawl-budget/",
            "internal": true
        },
        {
            "text": "URL",
            "url": "https://ursy.com/wiki/url/",
            "internal": true
        },
        {
            "text": "crawl rate",
            "url": "https://ursy.com/wiki/crawl-rate/",
            "internal": true
        },
        {
            "text": "robots.txt rules",
            "url": "https://developers.google.com/search/docs/crawling-indexing/robots/robots_txt",
            "internal": false
        },
        {
            "text": "robots.txt",
            "url": "https://ursy.com/wiki/robots-txt/",
            "internal": true
        },
        {
            "text": "AI assistants",
            "url": "https://ursy.com/wiki/ai-assistant/",
            "internal": true
        },
        {
            "text": "OAI-SearchBot",
            "url": "https://ursy.com/wiki/oai-searchbot/",
            "internal": true
        },
        {
            "text": "PerplexityBot",
            "url": "https://ursy.com/wiki/perplexitybot/",
            "internal": true
        },
        {
            "text": "live fetchers",
            "url": "https://ursy.com/wiki/live-fetcher/",
            "internal": true
        },
        {
            "text": "ChatGPT-User",
            "url": "https://ursy.com/wiki/chatgpt-user/",
            "internal": true
        },
        {
            "text": "AI Overview",
            "url": "https://ursy.com/wiki/ai-overview/",
            "internal": true
        },
        {
            "text": "AI visibility",
            "url": "https://ursy.com/wiki/ai-visibility/",
            "internal": true
        },
        {
            "text": "AI crawler",
            "url": "https://ursy.com/wiki/ai-crawler/",
            "internal": true
        },
        {
            "text": "server logs",
            "url": "https://ursy.com/wiki/server-logs/",
            "internal": true
        },
        {
            "text": "rate limit",
            "url": "https://ursy.com/wiki/rate-limiting/",
            "internal": true
        },
        {
            "text": "user agent",
            "url": "https://ursy.com/wiki/user-agent/",
            "internal": true
        },
        {
            "text": "soft 404",
            "url": "https://ursy.com/wiki/soft-404/",
            "internal": true
        },
        {
            "text": "pausing a website",
            "url": "https://developers.google.com/search/docs/crawling-indexing/pause-online-business",
            "internal": false
        },
        {
            "text": "Caching",
            "url": "https://ursy.com/wiki/caching/",
            "internal": true
        },
        {
            "text": "reverse DNS bot check",
            "url": "https://ursy.com/wiki/reverse-dns-bot-check/",
            "internal": true
        },
        {
            "text": "HTTP header checker",
            "url": "https://ursy.com/http-header-checker/",
            "internal": true
        },
        {
            "text": "redirect checker",
            "url": "https://ursy.com/redirect-checker/",
            "internal": true
        },
        {
            "text": "redirect",
            "url": "https://ursy.com/wiki/redirect/",
            "internal": true
        },
        {
            "text": "website down checker",
            "url": "https://ursy.com/webmaster-tools/website-down-checker/",
            "internal": true
        },
        {
            "text": "Google Search Console",
            "url": "https://ursy.com/wiki/google-search-console/",
            "internal": true
        },
        {
            "text": "log file analysis",
            "url": "https://ursy.com/wiki/log-file-analysis/",
            "internal": true
        },
        {
            "text": "log file analyser",
            "url": "https://ursy.com/pro/log-file-analyser/",
            "internal": true
        },
        {
            "text": "robots.txt checker",
            "url": "https://ursy.com/robots-txt-checker/",
            "internal": true
        },
        {
            "text": "Edge cache",
            "url": "https://ursy.com/wiki/edge-cache/",
            "internal": true
        },
        {
            "text": "Time to first byte",
            "url": "https://ursy.com/wiki/time-to-first-byte/",
            "internal": true
        }
    ],
    "words": 1219,
    "text": "A 502 Bad Gateway is an HTTP server error that a gateway or proxy sends when it asked the server behind it for a page and got back an invalid answer. The fault sits between two servers, not in the visitor’s browser. To people it looks like a broken site. To Googlebot it is a server error, and if it lasts, pages can drop out of the index. What is a 502 Bad Gateway? Most websites today are not one machine. A request often passes a CDN, a load balancer or a web application firewall before it reaches the origin server that builds the page. Each of these middle layers is called an intermediary. The HTTP standard, RFC 9110, says a gateway (also called a reverse proxy) is an intermediary that acts as the origin server for the outbound connection. When that gateway passes the request on and the reply it gets back is broken, it cannot hand the visitor a page. So it sends status code 502 instead. MDN’s page on 502 puts it the same way: a server acting as a gateway or proxy received an invalid response from the upstream server. It is one of the 5xx family of HTTP status codes, which all mean the server side failed. How is it different from 500, 503 and 504? Code Name What it tells you 500 Internal Server Error Something broke, no detail given. 502 Bad Gateway The middle layer got a bad reply from the server behind it. 503 Service Unavailable The server is not ready right now, often on purpose. 504 Gateway Timeout The middle layer got no reply at all in time. MDN notes that a 502 is a catch-all like 500, but it points to the place in the chain where things went wrong. If the gateway gets no response at all from the origin, the right code is 504 instead. MDN’s 503 page says that code is for temporary conditions, ideally sent with a Retry-After header giving the expected recovery time. What usually causes it? The application crashed. The process that runs your site (for example PHP on a WordPress site) died or restarted mid-request. Too few workers. All PHP workers are busy, so new requests are dropped or cut short. A bot flood. Heavy crawling or a DDoS attack eats the capacity real visitors need. A slow or broken plugin, database or outside API that hangs the page build. Wrong settings between layers. The proxy points at an old IP address, a closed port or a server with an expired SSL certificate. A DNS change that has not reached every layer yet. MDN adds one exception. If the site works for everyone else, the problem may be on the visitor’s side: a VPN, a firewall or local proxy settings. Why does it matter for search? Google’s page on HTTP and network errors treats 500, 502 and 503 the same way. Three things follow: Crawling slows. 5xx errors make Google’s crawlers slow down for a while. The drop is in proportion to how many separate URLs return errors. That hits your crawl budget. Content is ignored. Anything Google receives from a URL that returns 5xx is not used. Pages can fall out. Already indexed URLs are kept for a time, but URLs that keep returning a server error are eventually dropped from the index. Once the server returns 2xx codes again, Google says it raises the crawl rate step by step. A short blip is usually fine. Days of errors are not. Robots.txt is a special case. Google’s robots.txt rules say that if your robots.txt file returns a server error, Google stops crawling the whole site for the first 12 hours while it keeps retrying. For up to 30 days it then uses the last copy it fetched. So a 502 on that one small file can pause crawling of every page. Why does it matter for AI answers? AI assistants fetch pages too. OAI-SearchBot, PerplexityBot and live fetchers such as ChatGPT-User ask your server for a page when someone asks a question. If they get a 502, they have nothing to read or quote, and the answer is built from someone else’s page. Google’s AI features use pages from its normal index, so a URL dropped after long 5xx errors can no longer be a supporting link in an AI Overview. Uptime is part of AI visibility. A worked example A small online shop runs a sale. At 9am a newsletter goes out and an AI crawler is busy reading the catalogue at the same time. All PHP workers fill up. The CDN in front keeps passing requests on, the origin cuts them off, and the CDN shows visitors a 502 page. Checkout fails for about 40 minutes. The owner checks the server logs and sees one bot making most of the requests. They add a rate limit for that user agent, cache the category pages at the edge and raise the worker count. The errors stop. Google’s crawl rate dips for a day, then recovers. No pages were lost because the outage was short. Common mistakes Serving a friendly error page with status 200. People see “sorry”, but Google sees a normal page and may index the error text. That is a soft 404 problem in a different form. Using 502 for planned work. For short planned downtime Google’s guide on pausing a website says to return 503 with an informational page, for a few days at most. Caching the error. A CDN that stores the 502 page keeps serving it after the origin has recovered. Purge the cache after a fix. Blocking good bots to save load instead of finding the real cause. Check bots with a reverse DNS bot check first. Only checking the home page. Errors often hit heavy pages such as search, filters and checkout first. How to check it Run the address through our HTTP header checker to see the exact status code and which server layer answered. Use our redirect checker to see every hop, in case a redirect target is the part returning 502. Try the website down checker to see if the error shows for everyone or only for you. Open the Crawl stats report in Google Search Console and look at host status and server error responses. Read your logs with log file analysis to match the errors to a time, a page type or a bot. Our log file analyser is Pro. Confirm robots.txt itself returns 200 with the robots.txt checker. Questions Is a 502 my fault or my visitor’s? Almost always the site’s. If one person sees it and nobody else does, their network may be the cause. Will one 502 hurt my rankings? Not on its own. Google slows crawling and tries again. Pages are only dropped when errors persist. Should I return 502 on purpose? No. Use 503 for planned downtime, and 429 if you need a bot to slow down. Related words HTTP status code Origin server Edge cache Crawl budget Time to first byte Sources MDN: 502 Bad Gateway, checked 24 November 2026 MDN: 503 Service Unavailable, checked 24 November 2026 RFC 9110: HTTP Semantics, section 3.7 Intermediaries, checked 24 November 2026 Google Search Central: How HTTP status codes and network errors affect Google Search, checked 24 November 2026 Google Search Central: How Google interprets the robots.txt specification, checked 24 November 2026 Google Search Central: Pausing or disabling a website, checked 24 November 2026 Updated 24 November 2026 by URSY.com.",
    "source": "https://ursy.com/wiki/502-bad-gateway/"
}