Server Error5XX

HTTP 502 Bad Gateway

The server was acting as a middleman (gateway or proxy) and got an invalid response from the upstream server it was trying to reach.

When does this occur?

Your Nginx reverse proxy tries to connect to your Node.js app server but the app has crashed and is not responding properly.

SEO Impact

502 Bad Gateway usually means your application server (Node.js, Python, PHP) has crashed or is unreachable from your reverse proxy (Nginx, Apache). Sustained 502s will cause deindexing.

How to Fix

Check if your application process is running (`pm2 list`, `systemctl status`). Check Nginx error logs. Ensure the upstream address in your proxy config matches where your app is listening. Add health checks to automatically restart crashed processes.

Check how any URL responds in real time