Open-source personal finance manager. Self-hosted, privacy-first.
fix: re-resolve backend DNS in nginx to avoid 502s after redeploy (#368)
Tássio Noronhac8a08603f613
diff --git a/frontend/default.conf.template b/frontend/default.conf.templateindex e82b5e60..acd83726 100644--- a/frontend/default.conf.template+++ b/frontend/default.conf.template@@ -3,9 +3,17 @@ server {root /usr/share/nginx/html;index index.html;- # API proxy to backend+ # API proxy to backend.+ # Resolve the backend hostname at request time via Docker's embedded DNS+ # instead of caching the IP at startup. Without this, Nginx pins the+ # upstream IP when the config loads and returns 502s after the backend+ # container is recreated with a new IP (e.g. selective redeploys where the+ # frontend container is left running). Using a variable in proxy_pass forces+ # re-resolution; the resolver below is the Docker daemon's internal DNS.location /api/ {- proxy_pass ${BACKEND_URL};+ resolver 127.0.0.11 valid=5s;+ set $upstream ${BACKEND_URL};+ proxy_pass $upstream;proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;