Ways to Test Your Caching with cURL

Comments

4 comments

  • Cassandra Dixon

    You will want use --resolve in your curl command:

    curl -svo /dev/null --resolve '<customer_hostname>:443:<ip address of cache node>' <https URL>

    There are a few things you will need to confirm before running this command: * That you have TLS enabled with Fastly via a Shared Certificate or Hosted Cert * Determine the IP address of the cache node

    For instance: host cache-lax1420.hosts.fastly.net cache-lax1420.hosts.fastly.net has address "199.27.79.20"

    Note: If you have a hosted certificate, change the last octet to match your dedicated map

    Then run your command:

    Example:

    curl -svo /dev/null --resolve 'www.example.com:443:199.27.79.20' https://www.example,com/some_file

  • Christoph

    That's awesome, thanks so much @cassandra!

  • Rogier Mulhuijzen

    Another tip is to use --compressed so that curl sends Accept-Encoding: deflate, gzip, to mimic browser behavior a little more closely.

    And it's always a good idea to test both with and without --compressed to make sure that responses are compressed when they should be and aren't when they shouldn't. Content-Encoding: gzip in the response headers signifies that the response is compressed.

  • Paolo Mainardi

    To test with a loop: watch -n [number] curl -svo /dev/null [url] -H "Fastly-Debug: true"

    Where "number" is an integer.

Please sign in to leave a comment.