In short
A 502 Bad Gateway means: an intermediary server - such as the web server in front of PHP, a proxy or a CDN - received no valid response from the actual application server. The error often disappears again after a short time.
What does status code 502 mean?
Modern websites run through several stations: the web server accepts the request and passes it on to PHP or to another server. If this downstream station returns a faulty response or none at all, the web server reports 502 - it is the "gateway", the cause lies behind it.
Typical causes
- A PHP process crashed during the request, for example due to a fatal error in a plugin or extension
- Brief restarts of services, for example during updates
- With an upstream proxy or CDN: the origin server is unreachable or responds incorrectly
- Very large response headers, for example due to too many or too large cookies
- An incorrectly configured forwarding to an internal service or port
Solution for visitors
- Reload the page after a few seconds - many 502 errors are only short-lived.
- Delete the website's cookies if the error only occurs in your browser.
- If the error persists, contact the operator of the website.
Solution for site operators
- Check the error log: it shows whether PHP aborted with a fatal error and in which file (reading log files).
- Undo recent changes: if the error occurred after an update, deactivate the affected plugin or theme or restore a backup.
- Check the PHP version: is your system compatible with the selected PHP version?
- Proxy or CDN: check whether your website is reachable directly - without the upstream service. If you use ShieldCache or our CDN, we will look at both sides together with you.
- If the error occurs without any change on your side or persists for longer, contact our support team. Tell us the domain, time and affected address.
Related status codes
- 500 Internal Server Error - general server error
- 503 Service Unavailable - temporarily unavailable
- 504 Gateway Timeout - timeout
- All status codes at a glance