I am not sure if i got the RFC right, but this pretty much seems like a dns cacheing issue:
Try to modify you server.conf like this.
server {
...
# set DNS resolver as Docker internal DNS
resolver 127.0.0.11 valid=10s;
resolver_timeout 5s;
...
location / {
# prevent dns caching and force nginx to make a dns lookup on each request.
set $target http://web:8080;
proxy_pass $target;
..
}
}
The first part declares to use the swarm networks dns server with a short cache validation time.
The second part uses a indirect proxy_pass to prevent caching for the proxy_pass target at all.