Skip to content

Instantly share code, notes, and snippets.

@thoughtpolice
Created August 1, 2019 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thoughtpolice/8175c9ff36987ec75b15c3f8c4d78036 to your computer and use it in GitHub Desktop.
Save thoughtpolice/8175c9ff36987ec75b15c3f8c4d78036 to your computer and use it in GitHub Desktop.
Grab Fastly debugging info from cache.nixos.org
#!/usr/bin/env bash
[ -z "$1" ] && echo "ERROR: must provide arg" && exit 1
CACHE_URL=${CACHE_URL:-"https://cache.nixos.org"}
curl -v \
-HFastly-Debug:1 \
-o /dev/null 2>&1 \
"$CACHE_URL/$1" \
| grep -E '(fastly-debug|served-by|cache)'
@thoughtpolice
Copy link
Author

Example:

a@link> ./fastly-cache-debug.sh pwih6g12kymmk9nccajz7a934cp6n63h.narinfo

* Connected to cache.nixos.org (2a04:4e42::729) port 443 (#0)
*  subjectAltName: host "cache.nixos.org" matched cert's "cache.nixos.org"
> Host: cache.nixos.org
< fastly-debug-path: (D cache-dfw18637-DFW 1564664287) (F cache-dfw18645-DFW 1564663711)
< fastly-debug-ttl: (H cache-dfw18637-DFW 85823.753 0.000 576)
< fastly-debug-digest: 58e04fb08c285fa89bb1f7a7dd2123ee4bd04488df8bbf86c2fd074bae15490a
< x-served-by: cache-dfw18637-DFW
< x-cache: HIT
< x-cache-hits: 2
* Connection #0 to host cache.nixos.org left intact

More information on Fastly-Debug: 1 is available here: https://support.fastly.com/hc/en-us/community/posts/360040167211-Deciphering-Fastly-Debug-header

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment