Skip to content

Instantly share code, notes, and snippets.

@CajuCLC
Forked from wpsmithtwc/.curlrc-akamai
Created August 3, 2018 20:22
Show Gist options
  • Save CajuCLC/948796417ad2aae2838887645c1467a3 to your computer and use it in GitHub Desktop.
Save CajuCLC/948796417ad2aae2838887645c1467a3 to your computer and use it in GitHub Desktop.
# use a desktop user-agent string
#user-agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.186 Safari/535.1"
# use a mobile user-agent string
#user-agent = "Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3"
# When following a redirect, automatically set the previous URL as referer.
#referer = ";auto"
referer = "http://domain.com"
# Wait 60 seconds before timing out.
connect-timeout = 60
# do not show the speed output
silent
# show all headers REQUEST and RESPONSE
verbose
# send the output from the curl to /dev/null
output = /dev/null
# if a https is used do not verify certificate
insecure
# set the Pragma headers to retreive Akamai values
header = "Pragma: akamai-x-cache-on"
header = "Pragma: akamai-x-get-request-id"
header = "Pragma: akamai-x-cache-remote-on"
header = "Pragma: akamai-x-check-cacheable"
header = "Pragma: akamai-x-get-cache-key"
header = "Pragma: akamai-x-get-extracted-values"
header = "Pragma: akamai-x-get-nonces"
header = "Pragma: akamai-x-get-ssl-client-session-id"
header = "Pragma: akamai-x-get-true-cache-key"
header = "Pragma: akamai-x-serial-no"
header = "Pragma: akamai-x-get-client-ip"
header = "Pragma: akamai-x-feo-trace"
header = "Pragma: akamai-x-tapioca-trace"
header = "Pragma: edgegrid-fingerprints-on"
header = "Pragma: akamai-x-im-debug"

Akamai CDN Configuration Testing

Akamai Debug Headers!

Request Headers

  • -H "Pragma:akamai-x-get-client-ip, akamai-x-cache-on, akamai-x-cache-remote-on, akamai-x-check-cacheable, akamai-x-get-cache-key, akamai-x-get-extracted-values, akamai-x-get-nonces, akamai-x-get-ssl-client-session-id, akamai-x-get-true-cache-key, akamai-x-serial-no, akamai-x-feo-trace, akamai-x-get-request-id"

Edge Suite

  • curl -I -H "Host:<host>" http://<host>.edgesuite-staging.net
  • curl -I -H "Host:<host>" http://<host>.edgesuite.net

Edge Key (SSL)

  • curl -k -I -H "Host:<host>" https://<host>.edgekey-staging.net
  • curl -k -I -H "Host:<host>" https://<host>.edgekey.net

Examples

  • Edge Suite: curl -I -H "Pragma:akamai-x-get-client-ip, akamai-x-cache-on, akamai-x-cache-remote-on, akamai-x-check-cacheable, akamai-x-get-cache-key, akamai-x-get-extracted-values, akamai-x-get-nonces, akamai-x-get-ssl-client-session-id, akamai-x-get-true-cache-key, akamai-x-serial-no, akamai-x-feo-trace, akamai-x-get-request-id" -H "Host:<host>" http://<host>.edgesuite-staging.net
  • Edge Key (SSL): curl -I -H "Pragma:akamai-x-get-client-ip, akamai-x-cache-on, akamai-x-cache-remote-on, akamai-x-check-cacheable, akamai-x-get-cache-key, akamai-x-get-extracted-values, akamai-x-get-nonces, akamai-x-get-ssl-client-session-id, akamai-x-get-true-cache-key, akamai-x-serial-no, akamai-x-feo-trace, akamai-x-get-request-id" -H "Host:<host>" https://<host>.edgekey-staging.net

Using an Alias for Akamai

  • alias akamai='curl -I -H "Pragma:akamai-x-get-client-ip, akamai-x-cache-on, akamai-x-cache-remote-on, akamai-x-check-cacheable, akamai-x-get-cache-key, akamai-x-get-extracted-values, akamai-x-get-nonces, akamai-x-get-ssl-client-session-id, akamai-x-get-true-cache-key, akamai-x-serial-no, akamai-x-feo-trace, akamai-x-get-request-id" '

HTTP

  • akamai -H "Host:<host>" https://<host>.edgesuite-staging.net
  • akamai -H "Host:<host>" https://<host>.edgesuite.net

HTTPS

  • akamai -k -H "Host:<host>" https://<host>.edgekey-staging.net
  • akamai -k -H "Host:<host>" https://<host>.edgekey.net

HTTPS (Silent Mode)

  • akamai -k -s -H "Host:<host>" https://<host>.edgekey-staging.net
  • akamai -k -s -H "Host:<host>" https://<host>.edgekey.net

Performance Aliases

  • alias curl-perf-full="curl -w '\n content_type = %{content_type}\n filename_effective = %{filename_effective}\n ftp_entry_path = %{ftp_entry_path}\n http_code = %{http_code}\n http_connect = %{http_connect}\n local_ip = %{local_ip}\n local_port = %{local_port}\n num_connects = %{num_connects}\n num_redirects = %{num_redirects}\n redirect_url = %{redirect_url}\n remote_ip = %{remote_ip}\n remote_port = %{remote_port}\n size_download = %{size_download}\n size_header = %{size_header}\n size_request = %{size_request}\n size_upload = %{size_upload}\n speed_download = %{speed_download}\n speed_upload = %{speed_upload}\n ssl_verify_result = %{ssl_verify_result}\n time_appconnect = %{time_appconnect}\n time_connect = %{time_connect}\n time_namelookup = %{time_namelookup}\n time_pretransfer = %{time_pretransfer}\n time_redirect = %{time_redirect}\n time_starttransfer = %{time_starttransfer}\n time_total = %{time_total}\n url_effective = %{url_effective}\n\n' -o /dev/null -s"
    • Usage: curl-perf-full http://domain.com"
  • alias curl-perf="curl -w '\n time_namelookup = %{time_namelookup}\n time_appconnect = %{time_appconnect}\n time_connect = %{time_connect}\n time_redirect = %{time_redirect}\n time_pretransfer = %{time_pretransfer}\n time_starttransfer = %{time_starttransfer}\n time_total = %{time_total}\n\n' -o /dev/null -s "
    • Usage: curl-perf http://domain.com"

Curl Usage Examples

  • Using a config file: curl --config ~/.curlrc/akamai -LsD - "https://domain.com"
  • Using timing file: curl -w '@/Users/USERNAME/.curlrc/curl-timing.txt' -LsD - -o /dev/null "https://domain.com"
  • Using both:
    • curl --config ~/.curlrc/akamai -w '@/Users/USERNAME/.curlrc/curl-timing.txt' -LsD - "https://domain.com"
    • Assuming there is no output configuration within ~/.curlrc/akamai: curl --config ~/.curlrc/akamai -w "@Users/USERNAME/.curlrc/curl-timing.txt" -LsD - -o /dev/null "https://domain.com" 2>&1 | grep "^HTTP\|^X-Cache:\|time_total:"
    • In a loop: while true;do curl --config ~/.curlrc/akamai -w "@/Users/USERNAME/.curlrc/curl-timing.txt" -LsD - -o /dev/null "http://domain.com" 2>&1 | grep "^HTTP\|^X-Cache:\|time_total:";done
\n content_type = %{content_type}\n filename_effective = %{filename_effective}\n ftp_entry_path = %{ftp_entry_path}\n http_code = %{http_code}\n http_connect = %{http_connect}\n local_ip = %{local_ip}\n local_port = %{local_port}\n num_connects = %{num_connects}\n num_redirects = %{num_redirects}\n redirect_url = %{redirect_url}\n remote_ip = %{remote_ip}\n remote_port = %{remote_port}\n size_download = %{size_download}\n size_header = %{size_header}\n size_request = %{size_request}\n size_upload = %{size_upload}\n speed_download = %{speed_download}\n speed_upload = %{speed_upload}\n ssl_verify_result = %{ssl_verify_result}\n time_appconnect = %{time_appconnect}\n time_connect = %{time_connect}\n time_namelookup = %{time_namelookup}\n time_pretransfer = %{time_pretransfer}\n time_redirect = %{time_redirect}\n time_starttransfer = %{time_starttransfer}\n time_total = %{time_total}\n url_effective = %{url_effective}\n\n' -o /dev/null -s"`
* `alias curl-perf="curl -w '\n time_namelookup = %{time_namelookup}\n time_appconnect = %{time_appconnect}\n time_connect = %{time_connect}\n time_redirect = %{time_redirect}\n time_pretransfer = %{time_pretransfer}\n time_starttransfer = %{time_starttransfer}\n time_total = %{time_total}\n\n
\n
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_pretransfer: %{time_pretransfer}\n
time_redirect: %{time_redirect}\n
time_starttransfer: %{time_starttransfer}\n
----------\n
time_total: %{time_total}\n
\n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment