fix(nginx): use Docker embedded DNS resolver to avoid startup DNS failure
nginx resolves upstream hostnames at config load time, which fails when sibling containers haven't registered with the Docker DNS yet. Using resolver 127.0.0.11 with set $upstream defers resolution to request time, preventing the "host not found in upstream" startup crash.
This commit is contained in:
parent
af9c9dbae4
commit
f5abf359fb
1 changed files with 9 additions and 2 deletions
|
|
@ -2,6 +2,11 @@ server {
|
|||
listen 80;
|
||||
server_name _;
|
||||
|
||||
# Docker embedded DNS — defers upstream resolution to request time
|
||||
# This prevents nginx crashing at startup if sibling containers aren't
|
||||
# ready yet (which happens on the first `docker compose up`).
|
||||
resolver 127.0.0.11 valid=10s ipv6=off;
|
||||
|
||||
# Allow unlimited client upload size
|
||||
client_max_body_size 0;
|
||||
|
||||
|
|
@ -27,8 +32,9 @@ server {
|
|||
|
||||
# API proxy - forward to mam-api service
|
||||
location /api/ {
|
||||
set $api_upstream http://mam-api:3000;
|
||||
client_max_body_size 0;
|
||||
proxy_pass http://mam-api:3000;
|
||||
proxy_pass $api_upstream;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
|
@ -45,7 +51,8 @@ server {
|
|||
|
||||
# Capture proxy - forward to capture service
|
||||
location /capture/ {
|
||||
proxy_pass http://capture:3001;
|
||||
set $capture_upstream http://capture:3001;
|
||||
proxy_pass $capture_upstream;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
|
|
|||
Loading…
Reference in a new issue