pma-gateway: allow legacy and Virtuozzo host fallback for URL generation
parent
5098565f99
commit
0f819513e2
|
|
@ -45,12 +45,12 @@ fi
|
||||||
# derive *.sites.mightybox.cloud as a compatibility fallback.
|
# derive *.sites.mightybox.cloud as a compatibility fallback.
|
||||||
# If a regional sites domain is seen, also derive short <site>.mightybox.cloud
|
# If a regional sites domain is seen, also derive short <site>.mightybox.cloud
|
||||||
# as preferred public URL host candidate.
|
# as preferred public URL host candidate.
|
||||||
HOSTNAME_DOMAIN=$(hostname -f)
|
HOSTNAME_FQDN=$(hostname -f)
|
||||||
HOSTNAME_DOMAIN=${HOSTNAME_DOMAIN#node*-}
|
HOSTNAME_DOMAIN=${HOSTNAME_FQDN#node*-}
|
||||||
|
|
||||||
DOMAIN_CANDIDATES=()
|
DOMAIN_CANDIDATES=()
|
||||||
SEEN_DOMAINS="|"
|
SEEN_DOMAINS="|"
|
||||||
for candidate in "$CERT_DOMAIN" "${JELASTIC_ENV_DOMAIN:-}" "$HOSTNAME_DOMAIN"; do
|
for candidate in "$CERT_DOMAIN" "${JELASTIC_ENV_DOMAIN:-}" "$HOSTNAME_FQDN" "$HOSTNAME_DOMAIN"; do
|
||||||
# Normalize host-like input (strip scheme/path/port if present).
|
# Normalize host-like input (strip scheme/path/port if present).
|
||||||
candidate="${candidate#https://}"
|
candidate="${candidate#https://}"
|
||||||
candidate="${candidate#http://}"
|
candidate="${candidate#http://}"
|
||||||
|
|
@ -83,6 +83,10 @@ for candidate in "$CERT_DOMAIN" "${JELASTIC_ENV_DOMAIN:-}" "$HOSTNAME_DOMAIN"; d
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Preserve original host candidates (including legacy Virtuozzo domains)
|
||||||
|
# for URL-host fallback probing only.
|
||||||
|
URL_FALLBACK_DOMAIN_CANDIDATES=("${DOMAIN_CANDIDATES[@]}")
|
||||||
|
|
||||||
# Never use legacy *.sites.mightybox.dev domains for PMA gateway certificates.
|
# Never use legacy *.sites.mightybox.dev domains for PMA gateway certificates.
|
||||||
FILTERED_DOMAINS=()
|
FILTERED_DOMAINS=()
|
||||||
for candidate in "${DOMAIN_CANDIDATES[@]}"; do
|
for candidate in "${DOMAIN_CANDIDATES[@]}"; do
|
||||||
|
|
@ -557,11 +561,12 @@ if [[ "$URL_HOST" =~ ^(.+):[0-9]+$ ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Best-effort fallback: if preferred host is not reachable on 8443,
|
# Best-effort fallback: if preferred host is not reachable on 8443,
|
||||||
# try other known domain candidates before printing final gateway URL.
|
# try other known domain candidates (including preserved legacy/original
|
||||||
|
# Virtuozzo URL hosts for link fallback only) before printing final URL.
|
||||||
if command -v timeout >/dev/null 2>&1; then
|
if command -v timeout >/dev/null 2>&1; then
|
||||||
URL_HOST_CANDIDATES=()
|
URL_HOST_CANDIDATES=()
|
||||||
URL_HOST_SEEN="|"
|
URL_HOST_SEEN="|"
|
||||||
for candidate in "$URL_HOST" "$ENV_HOST" "${DOMAIN_CANDIDATES[@]}"; do
|
for candidate in "$URL_HOST" "$ENV_HOST" "${DOMAIN_CANDIDATES[@]}" "${URL_FALLBACK_DOMAIN_CANDIDATES[@]}"; do
|
||||||
candidate="${candidate#https://}"
|
candidate="${candidate#https://}"
|
||||||
candidate="${candidate#http://}"
|
candidate="${candidate#http://}"
|
||||||
candidate="${candidate%%/*}"
|
candidate="${candidate%%/*}"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue