A 502 Bad Gateway error means a server acting as a gateway or proxy received an invalid response from an upstream server. The front-end server (like Nginx or a CDN) is working, but the back-end application server it's trying to talk to isn't responding correctly.
First, check if your internet is working and what your current IP address is:
🔍 Check My IP Address →Modern websites use layers: a front-end server (Nginx, CDN, load balancer) passes requests to a back-end application server (PHP-FPM, Node.js, Python). 502 means the front-end got garbage or nothing from the back-end. Causes: back-end server crashed, is overloaded, or returned malformed data; the back-end is being restarted during deployment; network issues between the servers; or a Cloudflare/CDN routing problem.
502s are frequently caused by server restarts during deployments or brief overloads. Wait 30–60 seconds and press F5. If the site is undergoing maintenance or a high-traffic spike, this often resolves on its own within minutes.
Ctrl+Shift+Delete → All time → Cached images + Cookies → Clear. Then try a hard refresh with Ctrl+Shift+R to ensure you're not hitting a cached error response.
Sometimes 502 errors are caused by DNS routing you to a dead server in a CDN's pool. Switching to a different DNS server (8.8.8.8 or 1.1.1.1) may route you to a different CDN node that is working. Flush your DNS after switching: ipconfig /flushdns.
VPNs and proxies add an extra hop. If the VPN server is having routing issues to the destination, you may see 502. Disconnect from the VPN and connect directly to see if the error persists.
SSH into the server and restart your application process. For PHP-FPM: sudo systemctl restart php8.1-fpm. For Node.js (PM2): pm2 restart all. For Gunicorn/Python: restart the process. Also check back-end logs for crash reasons before restarting.
✅ Fixed it? Visit tools.examineip.com to confirm your IP address and connection are working correctly.
← Back to the complete guide: Internet Errors Hub
Last updated: April 2, 2026 • Report an error