My website suddenly failed to work this afternoon, responding every request with 502.

I've set up 3 backend instances behind ELB, each with Nginx installed.

At first, I suspected there's something wrong with the backend instances. But according to status description in the ELB console, all of the instances are in service.

Then I logged in to one of the instances to view the Nginx and app (which is served with uwsgi) logs. What I found out was that there were actually no 5xx errors there, I could see requests being responded with 200 OK.

According the trouble-shooting manual, cause of 502 could be

Malformed response from the instance or potentially an issue with the load balancer.

I didn't upgrade Nginx or uwsgi, so I don't think my backend has returned malformed responses that ELB couldn't understand.

What else could cause such a situation?


I've stopped the 502s by rolling back to an older version of my application, and it continues to work even after I redeploy the original version, so I guess it's the restarting that works.

  • Are you doing HTTPS > ELB > HTTP > nginx? – TheFiddlerWins Mar 26 '15 at 12:44
  • @TheFiddlerWins No, it's just HTTP. – Satoru.Logic Mar 26 '15 at 12:49
  • And this problem never occurs before. – Satoru.Logic Mar 26 '15 at 12:50
  • @TheFiddlerWins might be a bit late, but I'm wondering what caveat's behind the HTTPS > ELB > HTTP > nginx thing, as I'm facing a similar problem. – msp May 14 '18 at 9:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.