Introducing Signal Sciences Terraform Provider DevOps has always been part of Signal Sciences’ DNA: the…
We don’t always curl.. but when we do, we curl-trace.
Here at Signal Sciences we enjoy the finer things in life. We enjoy DevOps, strong security, and classy tech. Indulge us while we take a moment to push the boundaries on the latter of that list.
Let’s say you are debugging some simple web requests and trying to discern where things are slowing down. Curl is perfect for that. Well, sort of perfect. I don’t know about you but I forget all the switches for curl to make it work like I want. Especially in a situation where you need to do something quickly.
Let me introduce you to curl-trace.
It’s not a new thing to install, its just an opinionated way to run curl. To give you a feel for what it does, lets start with the output from curl-trace.
As you can see, this breaks up the request details like response code, redirects, and IP, in the “Request Details” section and then breaks down the timing of the request in the “Timing Analysis” section. This uses curl’s—write-out option and was inspired by this post, this post, and where I originally wrote about this over at the agile admin.
The goal of curl-trace is to quickly expose details for troubleshooting web performance.
How to setup curl-trace
Download .curl-format from github (or copy from below)
n Request Details:n url: %n num_redirects: %n content_type: %n response_code: %n remote_ip: %n n Timing Analysis:n time_namelookup: %n time_connect: %n time_appconnect: %n time_pretransfer: %n time_redirect: %n time_starttransfer: %n ----------n time_total: %n n
And put that in your home directory as .curl-format or wherever you find convenient.
Add an alias to your .bash_profile for curl-trace like this:
alias curl-trace=’curl -w “@/path/to/.curl-format” -o /dev/null -s’
Be sure to change the /path/to/.curl-format to the location you saved .curl-format. Once you do that, source your .bash_profile (or restart your bash session) and you are ready to go.
Now you can run this:
$ curl-trace https://google.com
Or follow redirects with -L
$ curl-trace -L https://google.com
You should see output like this
$ curl-trace https://signalsciences.com
Request Details: url: https://signalsciences.com/ num_redirects: 0 content_type: text/html; charset=utf-8 response_code: 200 remote_ip: 126.96.36.199
Timing Analysis: time_namelookup: 0.005 time_connect: 0.020 time_appconnect: 0.154 time_pretransfer: 0.154 time_redirect: 0.000 time_starttransfer: 0.660 — — — — — time_total: 0.660
Now you are ready to use curl-trace.
At Signal Sciences we are building the industry’s first Next Generation Web Application Firewall (NGWAF). Our NGWAF was built in response to our own frustrations of trying to use legacy WAFs while enabling business initiatives like DevOps, cloud adoption and continuous delivery. The Signal Sciences NGWAF works seamlessly across cloud, physical, and containerized infrastructure, providing security without breaking production traffic.