Using curl to view the HTTP headers of a file

We’ve started using Cloudflare on a big eCommerce site that I’ve been helping to upgrade the infrastructure for. Using curl (on OSX, Linux, etc.) is a really handy way to quickly view the http headers of a file such as an image to see if it’s been cached on a CDN, etc.

For example…

curl https://www.ichi.co.uk/content/images/2016/10/ichilogo2-trans.png -vso /dev/null

Gives the result (notice the CF-Cache-Status: HIT)…

*   Trying 104.27.160.139...
* Connected to www.ichi.co.uk (104.27.160.139) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
* Server certificate: sni64184.cloudflaressl.com
* Server certificate: COMODO ECC Domain Validation Secure Server CA 2
* Server certificate: COMODO ECC Certification Authority
* Server certificate: AddTrust External CA Root
> GET /content/images/2016/10/ichilogo2-trans.png HTTP/1.1
> Host: www.ichi.co.uk
> User-Agent: curl/7.49.1
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: Fri, 28 Oct 2016 18:36:28 GMT
< Content-Type: image/png
< Content-Length: 6563
< Connection: keep-alive
< Set-Cookie: __cfduid=df99a6065e4bf609dc434701e0039fab51477679788; expires=Sat, 28-Oct-17 18:36:28 GMT; path=/; domain=.ichi.co.uk; HttpOnly
< X-Powered-By: Express
< Cache-Control: public, max-age=31536000    
< Last-Modified: Wed, 26 Oct 2016 13:48:56 GMT
< ETag: W/"19a3-15801403c3c"
< CF-Cache-Status: HIT
< Expires: Sat, 28 Oct 2017 18:36:28 GMT
< Accept-Ranges: bytes
< Server: cloudflare-nginx
< CF-RAY: 2f907e5759c834be-LHR
< 
{ [823 bytes data]
* Connection #0 to host www.ichi.co.uk left intact
Author image
London
top