How to monitor HTTP headers in near real-time

Unix has many tools that you can stitch together to do useful things.

For example, if you want to watch your site headers in near real-time you can use watch and curl.

You might want to do that if you need to build information headers (like X-Cache-Info) and you want to quickly try out different ideas.

In my case I use it during a patch window to monitor when our site’s proxy server has changed so that the (now inactive) proxy can have updates applied.

The command that you run in a terminal is:

watch “curl -I -s http://www.example.com”

-I is headers only, while -s is silent. It’ll print the headers every two seconds by default. If you want to update every second it is:

watch -n 1 “curl -I -s http://www.example.com”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s