What Does HTTP 502 Mean?
HTTP 502 Bad Gateway indicates that the server, while acting as a gateway or proxy, received an invalid response from the inbound server.
Causes and How to Fix HTTP 502
Crashed backend processes (PHP-FPM, Gunicorn, Node.js), out-of-memory errors, or reverse proxy misconfigurations.
SEO & Search Engine Crawl Impact
502 means a gateway did not receive a valid upstream response. Check service health, connectivity and configuration before deciding whether a restart is appropriate.
Testing HTTP 502 via Terminal (cURL)
Inspect the HTTP response status and headers directly from your terminal:
curl -I -L https://example.com
curl -s -o /dev/null -w "%{http_code}\n" https://example.com
Web Server Configuration (Nginx & Apache)
Configure custom error handling in your web server:
# Nginx Custom Error Handler
error_page 502 /502.html;
location = /502.html {
root /var/www/html;
internal;
}