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?
BTW:
I've stopped the 502
s 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.
HTTPS > ELB > HTTP > nginx
thing, as I'm facing a similar problem.