fix: proxy admin via A public host, ClusterIP port 80 refused [deploy]
CI Pipeline / check-commit (push) Successful in 5s
CI Pipeline / deploy-only (push) Has been skipped
CI Pipeline / build (push) Successful in 20s
CI Pipeline / deploy (push) Successful in 17s

This commit is contained in:
mdszxy committed 2026-10-06 00:30:08 +08:00
1 parent 1ffb91509c
commit 74dd730e19
4 files changed
+23 -24

No files matched your search

+9 -6
View File
@@ -2,11 +2,14 @@
set -eu
CONF=/etc/nginx/conf.d/default.conf
# 集群内真实 Service:project57-svc:80(不是 project57-deploy:3000)
A_UPSTREAM="${A_UPSTREAM:-http://project57-svc.ns-project57.svc.cluster.local:80}"
# 集群内 ClusterIP:80 会 Connection refused,改走已验证可通的 A 站公网
A_UPSTREAM="${A_UPSTREAM:-https://project57.website-build.org}"
A_UPSTREAM="${A_UPSTREAM%/}"
A_PUBLIC="${A_PUBLIC:-https://project57.website-build.org}"
A_PUBLIC="${A_PUBLIC%/}"
A_HOST="$(printf '%s' "${A_UPSTREAM}" | sed -E 's|^[a-zA-Z][a-zA-Z0-9+.-]*://||; s|[:/].*$||')"
if [ -z "${A_HOST}" ]; then
A_HOST=project57.website-build.org
fi
NS="$(awk '/^nameserver/{print $2; exit}' /etc/resolv.conf || true)"
if [ -z "${NS}" ]; then
@@ -16,8 +19,8 @@ fi
sed -i \
-e "s|__RESOLVER__|${NS}|g" \
-e "s|__A_UPSTREAM__|${A_UPSTREAM}|g" \
-e "s|__A_PUBLIC__|${A_PUBLIC}|g" \
-e "s|__A_HOST__|${A_HOST}|g" \
"${CONF}"
echo "nginx upstream: ${A_UPSTREAM} (resolver ${NS}, public ${A_PUBLIC})"
echo "nginx upstream: ${A_UPSTREAM} (Host ${A_HOST}, resolver ${NS})"
nginx -t