A 502 bad gateway is an HTTP status code that means one server, acting as a gateway or proxy between your visitor and your website, received an invalid response from the server behind it. The fault sits on the server side, not on your visitor's phone or browser, which is why it is usually a hosting, plugin or CDN problem rather than a design one. If you are still working out what your site should cost to run and keep online, start with our website cost in South Africa guide, then come back here to fix the outage.
This post is a triage, not a list of ten random fixes. It shows how to tell in a few minutes whether you can solve the problem yourself (a plugin, a theme, a CDN setting) or whether you need to open a ticket with your host, and exactly what to put in that ticket.
Quick Answer
A 502 bad gateway means the server your visitor reached could not get a valid reply from the server behind it. First rule out your own connection. If something changed just before it started, work from the cheapest test to the most expensive: pause any CDN, deactivate plugins, switch to a default theme, then check the logs and DNS. If nothing changed on your side and every page fails, go straight to your host with the time, the URL and what you have ruled out. MDN's own guidance is that fixing the cause probably needs investigation by server owners or administrators.
Jump to
Site down right now and not sure why?
Send us the URL and what changed last, and we will say whether it looks like a host, plugin or CDN problem.
Book a Free ConsultationWhat Does a 502 Bad Gateway Error Mean?
A 502 bad gateway error means a server that was passing your visitor's request along to another server received an answer it could not use. MDN's reference for the 502 status code describes it as a generic catch-all for server errors, similar to a 500, but specific to the point in the request chain where the failure happened. The formal definition in RFC 9110 says the server "received an invalid response from an inbound server while attempting to fulfill the request."
For a normal business website, the chain looks like this: the visitor's browser asks for a page, a front server (the web server, a load balancer or a CDN such as Cloudflare) takes the request, and it hands it to the application behind it, which on a WordPress site is PHP. If PHP has crashed, is overloaded, or answers with garbage, the front server has nothing valid to return and shows a 502.
People who search for what is a 502 bad gateway often confuse it with its neighbours. The difference matters because each points at a different suspect.
| Status | What happened | Best For Narrowing Down |
|---|---|---|
| 500 Internal Server Error | The server itself failed while handling the request | Application code, a broken plugin or theme, a server configuration fault |
| 502 | A gateway or proxy received an invalid response from the server behind it | PHP or the origin server crashing, a CDN or firewall in front, a mismatch between layers |
| 504 Gateway Timeout | The gateway received no HTTP response from the origin at all | Slow or hung scripts, an overloaded origin, timeout settings |
MDN draws the 502 versus 504 line exactly there: if the proxy or gateway did not receive any HTTP response from the origin, it sends a 504 instead. In practice, hosts and CDNs word these pages differently, so treat the number as the clue and the wording as decoration.
Is It Your Website or Your Visitor's Connection?
A 502 is usually a fault between the front server and the application, so a visitor can rarely fix it, with the exception of local network, VPN, proxy or DNS problems on their own side. Before you start on the server, prove the problem is not on your side of the screen. Kinsta's troubleshooting guide lists browser problems and DNS problems among the possible causes, and also states that most 502 errors stem from hosting infrastructure rather than the client side.
Work through these checks in order:
- Reload once or twice. A brief spike or a restarting process can clear by itself.
- Try another network. Switch your phone from Wi-Fi or fibre to mobile data. If the site loads, the problem is local (or a routing issue between your ISP and the host), not your server.
- Try another device or a private window. This rules out a corrupted browser cache.
- Use a "down for everyone or just me" checker. If it reports the site as down globally, move on to the server-side checks below.
- Check a second page and wp-admin. If only the homepage fails, suspect a heavy template or a cache problem. If everything fails, suspect the whole server or the CDN.
If a customer reports the error and you cannot reproduce it, ask which page, roughly what time, and whether they were on mobile data or fibre. That detail goes straight into the host ticket later.
What Usually Causes a 502 on a WordPress Site?
A 502 bad gateway WordPress site problem normally traces to one of a handful of layers: the PHP process, a plugin or theme, the CDN or firewall in front, DNS, or the host's server resources. A symptom rarely proves a single cause, so the table below maps what you see to the hypotheses that fit and the check that separates them.
| What you see | Hypotheses | Check that tells them apart | Who Fixes It |
|---|---|---|---|
| Started right after a plugin, theme or PHP update | Faulty code crashing PHP; a plugin incompatible with the PHP version | Rename the plugins folder over FTP; if the site returns, re-enable plugins one at a time. Read the PHP error log for the fatal error. | You, or your developer |
| Only heavy actions fail (imports, backups, checkout, wp-admin saves) | A script hitting a PHP time limit; a worker killed mid-request; a heavy query | Does the same action fail on each attempt? Check the PHP and server error logs at the failure time. | You and the host |
| Comes and goes, worse at busy periods | Server overload; too few PHP workers for your traffic; a crawler or bot spike | Compare failure times with traffic in your host dashboard or logs. Ask the host about resource limits on your plan. | Host, then you (plan or caching) |
| Began after you switched on or changed a CDN, firewall or DNS record | Origin unreachable from the CDN; firewall blocking the CDN's requests; wrong origin address | Pause the CDN from its dashboard and test the origin directly. (A DNS bypass also works but is slower to undo and exposes the origin.) | You, or whoever manages DNS |
| Began after a host migration or server change | Misconfigured PHP or web server on the new setup; DNS pointing at the wrong server | Confirm which server the domain resolves to; ask the host to check the PHP service and its logs. | Host |
| Every page, all the time, nothing changed on your side | Host-side outage or crashed service | Check the host's status page and skip the DIY steps below: open a ticket straight away. | Host |
Kinsta's list of causes covers the same ground: server overload, firewall blocks, bad plugin or theme code, CDN or proxy problems, DNS problems and PHP timeouts. Their conclusion that most 502 errors come from hosting infrastructure is a useful prior, but it is the first column of the table, "what changed last", that usually decides who should act.
Takeaway
The most useful question during a 502 is not "what is wrong" but "what changed last". An update, a CDN or DNS change, a host move or a traffic spike each point at a different layer, and each has a different person who can fix it.
How Do You Fix a Failing Site Without Server Access?
Fixing a 502 without server access means testing low-risk changes in order (CDN, plugins, theme, logs and DNS) and handing over to the host once they are exhausted. To fix 502 bad gateway errors this way, stop as soon as the site returns. This order suits the "something changed" case; if nothing changed and every page fails, skip to the host ticket. Most of these steps are easy to undo, but a DNS change is the exception, because it takes time to propagate.
Step 1: Pause the CDN, if you use one
A CDN adds one more gateway to the chain. Cloudflare's documentation says 502 and 504 errors mean Cloudflare is unable to establish contact with your origin web server, and that the fix depends on who generated the error: a Cloudflare-branded error page points at your origin and host, while an unbranded page suggests Cloudflare itself, although Cloudflare notes that can also be caused by a compression issue at your origin (its remedy is to disable compression at the origin, then contact Cloudflare Support).
Pausing the CDN is our suggestion, not Cloudflare's: from the CDN's dashboard it is the safer way to see whether the origin answers on its own. Pointing DNS straight at the origin does the same job, but it is slower to undo and exposes the origin address and drops the CDN's firewall protection. If you do use Cloudflare, our Cloudflare free vs Pro guide shows which plan features sit in front of your origin.
Step 2: Deactivate all plugins over FTP
Deactivating every plugin at once isolates plugin code from everything else on the site. This is general WordPress troubleshooting practice (the WordPress developer documentation's common-errors page covers it but does not discuss 502s specifically). If you cannot reach wp-admin, its method is: locate wp-content/plugins and rename the folder (for example to plugins_old), which deactivates all plugins. If the site loads, rename it back and reactivate plugins one at a time until the 502 returns. The guilty plugin is the last one you switched on.
Step 3: Switch to a default theme
A theme can also crash PHP. The same WordPress documentation advises activating a default theme to rule out your active one. If a default theme loads cleanly and yours does not, the theme or its bundled code is the suspect. Our guide to WordPress critical error recovery mode covers the related case where WordPress itself tells you which plugin failed.
Step 4: Check the PHP version and error logs
A plugin that worked on one PHP version can crash on another, and the logs name the file and line. If you recently changed versions, read how to update WordPress PHP safely before rolling back. Many hosts expose error logs in the control panel; if yours does not, ask for them in the ticket.
Step 5: Check DNS and the host
If the 502 started after a DNS or hosting change, confirm the domain points at the server you think it does. Our DNS basics for business owners explains the records involved, and website hosting in South Africa covers what to expect from a host's support when you open that ticket.
Plugin conflict you cannot trace?
Tell us the order of your last few site changes and we will say whether it looks like something you can test yourself or something your host needs to check.
Talk to Us About Your OutageWhat Do the PHP Settings Behind a 502 Actually Control?
The PHP settings behind a 502 are mainly worker limits and timeouts: they cap how many requests PHP serves at once and how long one request may run, which is why a busy site can start failing without any change on your side. PHP-FPM is the process manager that runs PHP for many WordPress hosts. The PHP manual says pm.max_children sets the limit on the number of simultaneous requests that will be served, and that request_terminate_timeout is the timeout after which the worker serving a single request will be killed (default 0, meaning off). It also documents a slow log that dumps a PHP backtrace for requests slower than a configured timeout (default off).
You usually cannot change these on shared hosting, and you should not need to. The point is what to ask your host: whether the PHP process crashed or restarted at the failure time, whether the account hit its worker or resource limits, and whether the slow log can show which script was running. That is a far better ticket than "my site is down". If the failures cluster around peak trading times or load-shedding recoveries, say so: it helps the host see whether the account hit its limits when traffic or restarts bunched up.
Whether a particular host's limit, crash or timeout produces a 502 or a 504 depends on how that host has configured its web server, so do not read the number as a verdict on which setting is wrong.
What Should You Send Your Host When the Site Shows a 502?
A host ticket gets resolved faster when it states the exact time, the URL, what changed last and what you have already ruled out, because that lets support go straight to the logs for that moment. Cloudflare asks for the same discipline: for Cloudflare-side errors it requests the timestamp, the URL and the output from yourdomain/cdn-cgi/trace.
Include:
- The full URL that fails and whether other pages and wp-admin also fail.
- The time you first saw it and the time of your latest test, with timezone.
- What changed last (plugin, theme, PHP version, DNS, CDN, migration).
- What you already tried (CDN paused, plugins deactivated, default theme).
- Whether a CDN is in front, and if so whether the error page carries the CDN's branding (a hint, not proof, of where the error came from).
- A request for the PHP and web server error logs for that time window.
Weak ticket: "My website is showing a 502, please fix urgently."
Strong ticket: "All pages and wp-admin on example.co.za return 502 since about 09:40 SAST today. The last change was a plugin update at 09:30. I renamed the plugins folder and the 502 remains, and the CDN is paused. Please check whether PHP crashed or restarted at 09:40 and send me the PHP and web server error log for that time."
That second ticket tells the host that plugins are probably not the cause and that the origin is being tested directly, which saves the first two rounds of "have you tried disabling your plugins".
Will a 502 Hurt Your Google Rankings?
A short outage is unlikely to matter, but a server error that persists can lead Google to crawl the site less and eventually drop affected URLs. Google Search Central states that 5xx and 429 server errors prompt its crawlers to temporarily slow down crawling, and that already indexed URLs are preserved but eventually dropped if they persistently return a server error. Google's documentation does not say how long "persistently" is, so treat any time limit you read elsewhere as a guess.
The practical conclusion: fix the outage quickly, and do not rely on remembering to check. Setting up website uptime monitoring alerts you to a 502 when it starts instead of when a customer phones. Then confirm in Search Console that Google is fetching your pages normally again.
Takeaway
A 502 that clears within a short outage is an operations problem, not an SEO one. A 502 that sits unnoticed for days is where crawling slows and indexed URLs are at risk, which is why alerting is worth setting up before you need any individual fix.
How Do You Stop 502s Coming Back?
Preventing repeat 502s mostly comes down to controlling what changes on the site, watching the server, and being on a plan sized for your traffic. Those are three habits, none of them technical.
- Change one thing at a time. Update plugins in small batches, and note the time. When a 502 follows, the "what changed last" row of the table answers itself.
- Test updates on a copy first if your host offers a staging copy of the site, and keep a recent backup you can restore.
- Know your host's limits. If the 502 correlates with busy periods, ask whether the plan's resource limits are being hit before blaming the site. Our post on what a website costs to run per year puts hosting plans in context.
- Be alerted, not informed by customers. Monitoring that checks the page from outside tells you when it started.
If your site is hosted on a machine in your own office, power cuts become an uptime risk in their own right. That case is covered in our post on website uptime during load shedding.
Tired of site problems arriving as surprises?
Send us your current hosting and update setup and we will run a free audit of where an outage would catch you out.
Request a Free AuditWhy South African Businesses Choose Growth Pulse Media
Dirk van Greuning built and scaled a large South African ecommerce business before founding Growth Pulse Media, and the approach here is an operator's: an outage is a revenue problem first and a technical one second. All work is executed in-house, and the client load is kept limited so that a site problem gets senior attention rather than a ticket queue. If you want a site built so that an outage is easy to diagnose, rather than patched after the fact, see our web design service.
Who This Post Is NOT For
You are a visitor seeing a 502 on someone else's site. There is usually little you can fix, apart from local network, VPN, proxy or DNS problems on your own side. Reload, try another network, try again later, or contact the site owner; MDN notes that fixing the cause probably requires investigation by server owners or administrators.
Your site shows a different error. A 500, a 503, a white screen or a database connection error each have different causes. The 502-specific triage here will mislead you; start with the wp-admin and log checks in our website down checklist instead.
You run a managed or enterprise server stack of your own. If you control the web server, the PHP-FPM pool and the load balancer, you need the logs rather than this article. The steps above are written for owners who work through a host's panel and FTP.
Frequently Asked Questions
What does a 502 bad gateway mean?
A 502 bad gateway means a server acting as a gateway or proxy received an invalid response from the server behind it. It is a server-side error, so the visitor's device is rarely the cause. The usual suspects are PHP or the origin server, a CDN or firewall in front of it, and the host's resources.
Is a 502 my fault or the website's?
It is usually the website's or the host's side, not the visitor's, apart from local network, VPN, proxy or DNS problems. As a visitor, you can reload and try another network to rule out a local problem. As the site owner, the fault is somewhere between the front server and the application, which is why a host ticket is often the fastest route.
How long does a 502 last?
There is no standard duration. A brief spike or a restarting service can clear in moments, while a crashed plugin or a misconfigured server stays broken until someone changes it. If it has not cleared after a reload and a test from another network, treat it as a real outage and start the fix order.
What is the difference between a 502 and a 504?
A 502 means the gateway received an invalid response from the origin, while a 504 means the gateway received no HTTP response from the origin at all. Per MDN, the 504 is what a proxy sends when it gets nothing back. Both point to the origin server or the link to it.
Can a plugin cause a 502 on WordPress?
Yes. Faulty plugin or theme code can crash or stall PHP, and the front server then reports a 502. Renaming the plugins folder over FTP deactivates all plugins at once; if the site returns, reactivate them one at a time to find the culprit.
Does a 502 error affect SEO?
A brief 502 is unlikely to do lasting harm, but a persistent one can. Google says server errors make its crawlers slow down, and that URLs returning a server error persistently are eventually dropped from the index, without giving a time limit. Fix it quickly and confirm in Search Console that crawling has recovered.
Get your site outage looked at
Tell us what the site is showing, when it started and what changed last. We can also check what the downtime did to your Search Console and GA4 data. No obligation — we'll get back to you within 24 hours.
Request a Free Audit

