Saturday, December 24, 2016

Head HTTP Request using Curl to Test Amazon Cloudfront Configuration

You can use Curl with -I switch to test if the Cloudfront configuration is working. You can see that when I hit media subdomain, the first time it misses the Cloudfront, the next request hits the Cloudfront. This means Cloudfront is configured properly.
$ curl -I  https://media.rubyplus.com/graphql.mp4
HTTP/1.1 200 OK
Content-Type: application/octet-stream
Content-Length: 107703153
Connection: keep-alive
Date: Sun, 25 Dec 2016 01:25:07 GMT
Last-Modified: Sat, 24 Dec 2016 22:34:51 GMT
ETag: "55bf4669c44224e46e19531d-2"
Accept-Ranges: bytes
Server: AmazonS3
X-Cache: Miss from cloudfront
Via: 1.1 ca9fae216afadb306ee73a147fd8d410.cloudfront.net (CloudFront)
X-Amz-Cf-Id: 3TG8nVVEZHVICu9N1wLydenNBhSb7Yy8Ko57NWw==

$ curl -I  https://media.rubyplus.com/graphql.mp4
HTTP/1.1 200 OK
Content-Type: application/octet-stream
Content-Length: 107703153
Connection: keep-alive
Date: Sun, 25 Dec 2016 01:25:07 GMT
Last-Modified: Sat, 24 Dec 2016 22:34:51 GMT
ETag: "55bf4669c44224e46e195bc3f993a31d-2"
Accept-Ranges: bytes
Server: AmazonS3
Age: 33
X-Cache: Hit from cloudfront
Via: 1.1 ae7118021d1020068bf9f.cloudfront.net (CloudFront)

X-Amz-Cf-Id: hA2bDLM2QfD_nYy8jXJqV8zY6Tg==

No comments:

Post a Comment