Spaces:
Sleeping
Sleeping
| set -euo pipefail | |
| if [[ -z "${SPACE_URL:-}" ]]; then | |
| echo "ERROR: SPACE_URL is required." | |
| echo "Example: SPACE_URL='https://username-space-name.hf.space' ./scripts/test_space.sh" | |
| exit 1 | |
| fi | |
| SPACE_URL="${SPACE_URL%/}" | |
| TS="$(date -u +%Y%m%dT%H%M%SZ)" | |
| CACHE_BUSTER="ts=${TS}" | |
| printf '\nDocker Routing Canary public route test\n' | |
| printf 'Space URL: %s\n' "$SPACE_URL" | |
| printf 'UTC time: %s\n\n' "$TS" | |
| probe() { | |
| local path="$1" | |
| printf '\n============================================================\n' | |
| printf 'GET %s%s?%s\n' "$SPACE_URL" "$path" "$CACHE_BUSTER" | |
| printf '============================================================\n' | |
| curl -i \ | |
| --max-time 30 \ | |
| --connect-timeout 15 \ | |
| -H 'Cache-Control: no-cache' \ | |
| -H 'Pragma: no-cache' \ | |
| "${SPACE_URL}${path}?${CACHE_BUSTER}" | |
| printf '\n' | |
| } | |
| probe "/" | |
| probe "/__routing_probe" | |
| probe "/health" | |
| probe "/headers" | |
| probe "/plain" | |
| cat <<'EOF_SUMMARY' | |
| Interpretation: | |
| - If responses contain "source":"canary-container" and logs show CANARY_REQUEST, public traffic reached the container. | |
| - If responses show unrelated JSON such as {"data":[]} and logs show no CANARY_REQUEST, the request likely did not reach the container. | |
| - If the response is 404 but logs show CANARY_REQUEST, the proxy reached the container but the path is wrong. | |
| EOF_SUMMARY | |