[PR #83] [MERGED] fix: prevent nginx 502 after backend container restart via runtime DNS resolution #85

Closed
opened 2026-08-13 19:11:27 +02:00 by zaph0d · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/niels-emmer/myace/pull/83
Author: @niels-emmer
Created: 8/12/2026
Status: Merged
Merged: 8/12/2026
Merged by: @niels-emmer

Base: mainHead: fix/nginx-dns-resolution


📝 Commits (1)

  • adaeacd fix: prevent nginx 502 after backend container restart via runtime DNS resolution

📊 Changes

2 files changed (+27 additions, -1 deletions)

View changed files

📝 docs/debugging.md (+21 -0)
📝 frontend/nginx.conf (+6 -1)

📄 Description

Summary

nginx resolves upstream hostnames at startup and caches the IP. When the backend container is recreated during deploy, it gets a new Docker-internal IP and nginx 502s until restarted. This happened on the previous deploy — the postgres-backup sidecar PR rebuilt the backend, and the frontend's nginx was still pointing at the old IP.

Fix

Use a variable in proxy_pass (set $backend_upstream), which forces nginx to resolve DNS at runtime instead of caching at startup.

Changes

File Change
frontend/nginx.conf proxy_pass now uses $backend_upstream variable
docs/debugging.md Added '502 Bad Gateway from nginx' entry with symptom/cause/fix

Testing

  • docker compose -f docker-compose.yml -f docker-compose.dev.yml config validates
  • Deploy no longer needs a separate docker compose restart frontend step

Checklist

  • Self-review completed
  • No new warnings
  • Documentation updated
  • Breaking changes: none

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/niels-emmer/myace/pull/83 **Author:** [@niels-emmer](https://github.com/niels-emmer) **Created:** 8/12/2026 **Status:** ✅ Merged **Merged:** 8/12/2026 **Merged by:** [@niels-emmer](https://github.com/niels-emmer) **Base:** `main` ← **Head:** `fix/nginx-dns-resolution` --- ### 📝 Commits (1) - [`adaeacd`](https://github.com/niels-emmer/myace/commit/adaeacd02cfc14aecaf2834511a57ad05154e63e) fix: prevent nginx 502 after backend container restart via runtime DNS resolution ### 📊 Changes **2 files changed** (+27 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `docs/debugging.md` (+21 -0) 📝 `frontend/nginx.conf` (+6 -1) </details> ### 📄 Description ## Summary nginx resolves upstream hostnames at startup and caches the IP. When the backend container is recreated during deploy, it gets a new Docker-internal IP and nginx 502s until restarted. This happened on the previous deploy — the postgres-backup sidecar PR rebuilt the backend, and the frontend's nginx was still pointing at the old IP. ## Fix Use a variable in `proxy_pass` (`set $backend_upstream`), which forces nginx to resolve DNS at runtime instead of caching at startup. ## Changes | File | Change | |------|--------| | `frontend/nginx.conf` | `proxy_pass` now uses `$backend_upstream` variable | | `docs/debugging.md` | Added '502 Bad Gateway from nginx' entry with symptom/cause/fix | ## Testing - `docker compose -f docker-compose.yml -f docker-compose.dev.yml config` validates - Deploy no longer needs a separate `docker compose restart frontend` step ## Checklist - [x] Self-review completed - [x] No new warnings - [x] Documentation updated - [x] Breaking changes: none --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
zaph0d 2026-08-13 19:11:27 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
github-mirrors/myace#85
No description provided.