I've got a project Django, gunicorn, nginx.
It mostly works (most of the endpoints), but sometimes nginx throws 502 BAD GATEWAY.
Error is upstream prematurely closed connection while reading response header from upstream
Do you have any idea what's wrong with it?
Thanks!
Sometimes it's happen when page render time more longer then expected
Try to increase timeout (nginx has 60s default timeout)
Read more here http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_read_timeout