I have an application that sits behind an nginx reverse proxy. Nothing fancy, just a simple
server {
listen 54321;
proxy_connect_timeout 5000ms;
proxy_read_timeout 5000ms;
location / {
proxy_pass http://localhost:54322/;
}
}
nginx starts first. If I try to hit the application while it is down, I get a 502 Bad Gateway. That's expected but if I start the application, I still get a 502. It is only after I restarted nginx that requests finally go through.
How can I instruct nginx to keep trying (at least periodically) to connect to the backend?