502 Bad Gateway

How to Fix “502 Bad Gateway”

HTTP Status Error 📄 All browsers
⚡ Quick answer

A 502 Bad Gateway error means a server acting as a gateway (like a proxy or load balancer) received an invalid response from an upstream server. This is always a server-side issue — not caused by your device or network.

First, check if your internet is working and what your current IP address is:

🔍 Check My IP Address →

What Causes the “502 Bad Gateway” Error?

Modern websites use multiple servers — a front-end server (like Nginx or Cloudflare) passes requests to a back-end application server. A 502 error means the front-end server received a broken, empty, or invalid response from the back-end. Common causes include: the back-end server is down or overloaded, the application crashed, a deployment went wrong, the back-end timed out under heavy load, or a misconfigured proxy or load balancer.

How to Fix It — 5 Methods

1 Reload the page — wait and retry
  1. Press Ctrl+F5 for a hard reload
  2. Wait 30 seconds and try again — 502 errors under load often resolve themselves
  3. Try on mobile data to confirm it is not your network
2 Clear browser cache
  1. Press Ctrl+Shift+Delete
  2. Select All time, check cached images and cookies
  3. Clear and reload
3 Try a different DNS server

Occasionally DNS issues can make a working server appear to return 502. Switch to Google DNS (8.8.8.8) or Cloudflare (1.1.1.1) and retry.

4 Flush DNS and restart browser
  1. Windows: Run ipconfig /flushdns in Command Prompt
  2. Restart Chrome completely (close all windows, reopen)
  3. Navigate to the site fresh
5 If you own the site — restart the application server
  1. SSH into your server
  2. Restart your application: sudo systemctl restart php-fpm or pm2 restart all
  3. Check Nginx/Apache error logs: tail -f /var/log/nginx/error.log
  4. Check if memory limits were hit and scale up if needed
🔒
Some errors are caused by ISP blocks or network restrictions
A VPN bypasses them instantly by routing through a different server.

Fixed it? Visit tools.examineip.com to confirm your IP address and connection are working correctly.

Frequently Asked Questions

Is a 502 Bad Gateway my internet's fault?
No. A 502 is always a server-side issue between the front-end gateway and the back-end server. Your internet and device are fine.
Why do I get 502 during peak hours?
High traffic overloads back-end servers causing them to respond slowly or not at all. The front-end gateway times out waiting for a response and returns 502. This is very common on popular sites during viral events.
What is the difference between 502 and 504?
502 means the gateway received an invalid response from the upstream server. 504 means the gateway timed out waiting for a response. Both indicate back-end server problems.

Learn More About IP Addresses & Privacy

Other Internet Errors Explained

← Back to the complete guide: Internet Errors Hub

Last updated: March 30, 2026 • Report an error

Scroll to Top