← back to Wallpapercanada

scripts/diagnose-cache.sh

16 lines

#!/usr/bin/env bash
# READ-ONLY: is the app serving the link (so nginx is caching a stale copy)?
set -uo pipefail
PROD="${PROD_HOST:-root@45.61.58.125}"
SSH_OPTS="-o ConnectTimeout=10 -o StrictHostKeyChecking=accept-new"
ssh $SSH_OPTS "$PROD" bash -s <<'EOF'
echo "== app direct (127.0.0.1:9873) has the link? =="
curl -s --max-time 10 http://127.0.0.1:9873/ | grep -c 'designerwallcoverings.com" target="_blank"'
echo "== nginx caching / header directives for the site =="
grep -nE "proxy_cache|proxy_cache_key|expires|add_header|proxy_pass|sendfile" /etc/nginx/sites-available/wallpapercanada.com 2>/dev/null
echo "== proxy_cache_path defined anywhere? =="
grep -rInE "proxy_cache_path|proxy_cache_key" /etc/nginx/ 2>/dev/null | head
echo "== live response Age/cache headers via localhost Host header =="
curl -s -D - -o /dev/null --max-time 10 -H "Host: wallpapercanada.com" http://127.0.0.1/ 2>/dev/null | grep -iE "age:|x-cache|cache-control|x-powered-by" | head
EOF