feat: Z34b restore-by-host + harden web nginx DNS race

Add HMAC restore-by-host for phone-less rebind; resolve gateway at request time and recreate web after stack up.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
whm
2026-08-07 00:16:08 +08:00
parent f0fcc1fbda
commit e571e98387
12 changed files with 492 additions and 30 deletions

View File

@@ -1,3 +1,7 @@
# Podman/Docker静态 proxy_pass 会在启动时解析 upstreamgateway 尚未进 DNS 时会 emerg 退出。
# 变量 + resolver 改为请求时解析127.0.0.11=Docker 内置 DNS10.89.0.1=常见 Podman aardvark。
resolver 127.0.0.11 10.89.0.1 valid=10s ipv6=off;
server {
listen 80;
server_name _;
@@ -5,7 +9,8 @@ server {
index index.html;
location /api/ {
proxy_pass http://gateway:8180;
set $gw_upstream gateway:8180;
proxy_pass http://$gw_upstream;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
@@ -15,7 +20,8 @@ server {
}
location /ai/ {
proxy_pass http://gateway:8180;
set $gw_upstream gateway:8180;
proxy_pass http://$gw_upstream;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header Authorization $http_authorization;
@@ -23,7 +29,8 @@ server {
}
location /gateway/ {
proxy_pass http://gateway:8180;
set $gw_upstream gateway:8180;
proxy_pass http://$gw_upstream;
proxy_http_version 1.1;
proxy_set_header Host $host;
}
@@ -31,4 +38,4 @@ server {
location / {
try_files $uri $uri/ /index.html;
}
}
}