From 7c33b7a7d303150db6787e60257a6979e2078d2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Faleiros?= Date: Tue, 1 Sep 2026 11:33:07 -0300 Subject: [PATCH] fix: defer API DNS resolution in nginx --- docker/nginx.conf | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docker/nginx.conf b/docker/nginx.conf index 2333028..6c86bcc 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -4,8 +4,15 @@ server { root /usr/share/nginx/html; index index.html; + # Docker Swarm may start this container before the API service receives a DNS + # record. Resolving through Docker DNS at request time keeps Nginx alive while + # the API starts or is replaced during a rolling deployment. + resolver 127.0.0.11 ipv6=off valid=10s; + resolver_timeout 5s; + set $api_upstream api; + location /api/ { - proxy_pass http://api:3001; + proxy_pass http://$api_upstream:3001; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr;