title: NGINX, wait for proxy if not available
body: <p>I have a NGINX set up with reverse_proxy and caching (only caching multiple requests for very short time). The backend nginx calls is running locally (reverse proxy address is localhost:8092). 
  The backend sometimes needs to restart which takes it offline for a duration of ~2-3 seconds. Currently, nginx serves a 502 for this time. I would prefer stalling requests for that time. 
  Is it possible to configure nginx that it waits in case of a 502 and retries periodically? </p>
  
  <p>I know that this is not the cleanest way to solve this but this is not a production system so that this (if possible) appears to be the simplest solution.</p>
  
  <p>The system is running Ubuntu 16.04LTS with nginx 1.10.3 </p>