fix(nginx): Docker-DNS-Resolver gegen 502 nach API-Recreate, Deploy prueft Health inhaltlich

This commit is contained in:
2026-10-04 16:43:49 +02:00
parent ca12bc9f46
commit 3386cdab25
8 changed files with 27 additions and 4 deletions
+9 -2
View File
@@ -9,6 +9,11 @@ server {
gzip_types text/css application/javascript image/svg+xml application/json;
gzip_min_length 1024;
# Docker-eigener DNS: Upstream-Namen bei jeder Anfrage neu auflösen.
# Ohne das puffert nginx die Container-IP vom Start – nach einem Recreate
# der API (neue IP) liefert jede Anfrage 502, bis nginx selbst neu startet.
resolver 127.0.0.11 valid=10s;
# HTML nie cachen (Assets sind hash-benannt → ein Reload genügt)
location = /index.html {
add_header Cache-Control "no-cache" always;
@@ -25,7 +30,8 @@ server {
# NIE im Repo und NIE im Browser – der Endpunkt ist nur vom Server erreichbar.
location = /api/mail/send {
limit_except POST { deny all; }
proxy_pass http://mp-mail-api:8080/send;
set $mail_api http://mp-mail-api:8080;
proxy_pass $mail_api/send;
proxy_set_header Host $host;
proxy_set_header X-Api-Token "${MAIL_API_TOKEN}";
proxy_set_header X-Request-Source mieterportal-nginx;
@@ -36,7 +42,8 @@ server {
# Portal-API (Node/Express + PostgreSQL): Auth, Daten, Benachrichtigungen,
# Dokumenten-Uploads/-Downloads (PDF bis 25 MB).
location /api/ {
proxy_pass http://mp-api:3000;
set $portal_api http://mp-api:3000;
proxy_pass $portal_api;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;