diff --git a/docker/nginx.conf b/docker/nginx.conf index 8efc8a8..3dd642d 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -4,14 +4,19 @@ server { root /usr/share/nginx/html; index index.html; + # Use Docker's embedded DNS with 30s TTL so upstream IPs refresh + # after container recreates + resolver 127.0.0.11 valid=30s ipv6=off; + # SPA fallback location / { try_files $uri $uri/ /index.html; } - # API proxy + # API proxy — variable forces nginx to re-resolve on each request location /api/ { - proxy_pass http://chrysopedia-api:8000; + set $backend http://chrysopedia-api:8000; + proxy_pass $backend; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; @@ -19,6 +24,7 @@ server { } location /health { - proxy_pass http://chrysopedia-api:8000; + set $backend http://chrysopedia-api:8000; + proxy_pass $backend; } }