We have several rails apps under common domain in Docker, and we use nginx to direct requests to specific apps.
our_dev_server.com/foo # proxies to foo app
o
The main advantage of using upstream is to define a group of servers than can listen on different ports and configure load-balancing and failover between them.
In your case you are only defining 1 primary server per upstream so it must to be up.
Instead, use variables for your proxy_pass(es) and remember to handle the possible errors (404s, 503s) that you might get when a target server is down.