release 1.10.10: monpages bare code 21 soft WARN by default

This commit is contained in:
Hernâni Marques 2026-07-19 01:47:44 +02:00
parent 7105c3eccd
commit 021cf5164a
No known key found for this signature in database
GPG key ID: CB5738652768F7E9
3 changed files with 11 additions and 3 deletions

View file

@ -396,8 +396,15 @@ 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
# 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.
# Bare without trailing slash often hits merchant until Caddy has redir * /path/ 302.
# Default: WARN on bare (soft) so slash-OK stacks still publish green/yellow pages.
# MONPAGES_BARE_STRICT=1 → ERROR (enforce bare redir live).
if [ "$soft" = "1" ]; then
warn "public mon page bare URL" \
"$url -> HTTP $code code 21 (prefer trailing slash; Caddy: redir * /path/ 302; set MONPAGES_BARE_STRICT=1 to ERROR)"
rm -f "$body"
return 0
fi
_mon_fail_or_soft "public mon page missing" \
"$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"