release 1.9.3: monpages code 21 always ERROR; suite apply script + absolute paths

This commit is contained in:
Hernâni Marques 2026-07-19 01:09:52 +02:00
parent 530385b19d
commit ea95fb3d8d
No known key found for this signature in database
GPG key ID: CB5738652768F7E9
7 changed files with 154 additions and 59 deletions

View file

@ -380,14 +380,10 @@ check_one() {
fi
if grep -qE '"code"[[:space:]]*:[[:space:]]*21' "$body" 2>/dev/null \
|| grep -qiE 'There is no endpoint defined for the URL' "$body" 2>/dev/null; then
if [ "$soft" = "1" ]; then
warn "public mon page bare URL" \
"$url -> HTTP $code code 21 (prefer trailing slash; set MONPAGES_BARE_STRICT=1 to ERROR)"
rm -f "$body"
return 0
fi
# Merchant code 21 is always ERROR (even bare): slash-only soft mode used to hide
# Caddy redir footgun (redir /path/ 302 → Location:302). Bare must 302/200 HTML.
_mon_fail_or_soft "public mon page missing" \
"$url -> HTTP $code merchant/API JSON code 21 (publish HTML + reverse-proxy handle /monitoring*)" || { rm -f "$body"; return 1; }
"$url -> HTTP $code merchant/API JSON code 21 (Caddy handle/redir; use redir * /path/ 302 inside handle; apply: sudo /home/hernani/koopa-caddy/apply-monitoring-live.sh)" || { rm -f "$body"; return 1; }
rm -f "$body"
return 0
fi
@ -447,10 +443,11 @@ while IFS= read -r line; do
URLS+=("$line")
done < <(build_urls | sort -u)
# Bare URLs without trailing slash: optional soft check (default on).
# Many reverse proxies only redirect /monitoring → /monitoring/; bare may hit the app (code 21).
# Bare URLs without trailing slash: checked by default.
# Merchant JSON code 21 is always ERROR (Caddy/proxy not serving mon path).
# Other bare failures: WARN unless MONPAGES_BARE_STRICT=1 (then ERROR).
# MONPAGES_CHECK_BARE=0 → skip bare entirely
# MONPAGES_BARE_STRICT=1 → bare failures are ERROR (default: WARN if slash form exists)
# MONPAGES_BARE_STRICT=1 → non-21 bare failures are ERROR too
if [ "${MONPAGES_CHECK_BARE:-1}" = "1" ]; then
_extra=()
for u in "${URLS[@]}"; do
@ -486,7 +483,8 @@ done
if [ "$ec" -ne 0 ]; then
echo " hint: public monitoring HTML not served (404 / merchant code 21)"
echo " publish staging HTML + configure reverse-proxy/Caddy handle for mon paths"
echo " (on koopa: sudo ~/koopa-caddy/apply-monitoring-live.sh)"
echo " (on koopa: sudo /home/hernani/koopa-caddy/apply-monitoring-live.sh)"
echo " bare code 21: Caddy redir inside handle must be: redir * /path/ 302 (not redir /path/ 302)"
if [ "$_fam" = "fp" ]; then
echo " FP: only FP mon hosts are checked — wire Infomaniak vhost for /monitoring*"
fi