From 9b4fe6677c5000a5ff16f1514657c4900252c101 Mon Sep 17 00:00:00 2001 From: vithobaa Date: Mon, 29 Jun 2026 18:31:15 +0530 Subject: [PATCH] fix: nginx resolves upstream at request time via Docker DNS Nginx was crashing on startup because it tried to resolve the 'master' hostname before the Spring Boot container was ready. Fixed by using Docker's embedded DNS resolver (127.0.0.11) and a variable for proxy_pass, which defers resolution to request time. --- ui/nginx.conf | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ui/nginx.conf b/ui/nginx.conf index a50c4c1..80723ea 100644 --- a/ui/nginx.conf +++ b/ui/nginx.conf @@ -5,6 +5,10 @@ server { # Allow large request bodies (screenshots are base64 encoded) client_max_body_size 50M; + # Use Docker's internal DNS resolver — resolves upstream at request time, not startup + resolver 127.0.0.11 valid=30s; + set $backend http://master:9090; + # Serve static files from the React build location / { root /usr/share/nginx/html; @@ -14,8 +18,8 @@ server { # Reverse proxy API requests to the Master backend container location /api/ { - proxy_pass http://master:9090; - + proxy_pass $backend; + # Standard proxy headers proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr;