Created
January 28, 2016 18:13
-
-
Save mostlygeek/f5f3dd59b7b631b64a98 to your computer and use it in GitHub Desktop.
Test CDN before migrating the actual DNS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# <3 curl. | |
# | |
# Pages to check on MDN to get resource URIs | |
URLS=' | |
https://developer.mozilla.org/en-US/ | |
https://developer.mozilla.org/en-US/docs/Web/HTML | |
https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements | |
https://developer.mozilla.org/en-US/docs/Web/API | |
https://developer.mozilla.org/en-US/docs/Web/API/IDBIndexSync | |
https://developer.mozilla.org/en-US/Apps | |
' | |
for URL in $URLS | |
do | |
# grab an IP address from the CDN using the R53 Alias | |
# this will be given to curl as a DNS override | |
IP=$(dig mdn-cdn.prod.mozaws.net +short | head -1) | |
echo "Checking $URL @ cdn $IP" | |
# grep out URIs that point at the CDN and check them | |
for RESOURCE in $(curl -s --resolve developer.cdn.mozilla.net:443:$IP "$URL" | \ | |
grep developer.cdn.mozilla.net | \ | |
grep -v noscript | grep -oE "https://[^\"']*\.(css|png|js)") | |
do | |
printf " - check ($IP) => $RESOURCE: " | |
curl -sI --resolve developer.cdn.mozilla.net:443:$IP "$RESOURCE" | grep "HTTP/1.1 200 OK" | |
done | |
done | |
jezdez
commented
Jan 28, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment