Fixng Nginx 502 Gateway Timeout with proxy_pass During Deployments
blog.winricklabs.com
blog.winricklabs.com
If the backend is able to perform a "reload" (vs. a slower stop/start or restart) and/or replace the old instances with the new when they're up -- assuming that's an atomic operation -- nginx will not return a 502.
If one is rapidly iterating and prefers having a somewhat cleaner stop/start, the advice can be helpful even though it masks/papers over a problem (the backend being down).
IIS web server has this but not nginx :(
Otherwise, the requests will potentially wait a long time to be handled while the app starts up.