HTTP Code: 502 (Bad Gateway)
HTTP Status Code Reference
Status Category
5xx — Server Error
Meaning & Definition
The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request.
Common Causes
- Upstream backend service down (PHP-FPM, Node process offline)
- Wrong upstream port mapping configurations
- Internal proxy routing failures
How to resolve HTTP code errors
1. Inspect Logs: Check server logs (e.g. error.log) to locate runtime exceptions or database disconnects.
2. Test Endpoint: Use our Uptime Checker or redirects prober to verify response headers and payload size.
3. Configure Rules: Implement custom redirect rules or error fallback paths below in Nginx/Apache config.
Nginx Configuration Setup
location / {
proxy_pass http://127.0.0.1:3000;
proxy_next_upstream error timeout invalid_header http_502;
}Apache Configuration Setup
ProxyPass / http://127.0.0.1:3000/ ProxyPassReverse / http://127.0.0.1:3000/