Make HTTPerf use a proxy for connections

Want to help support this blog? Try out Oh Dear, the best all-in-one monitoring tool for your entire website, co-founded by me (the guy that wrote this blogpost). Start with a 10-day trial, no strings attached.

We offer uptime monitoring, SSL checks, broken links checking, performance & cronjob monitoring, branded status pages & so much more. Try us out today!

Profile image of Mattias Geniar

Mattias Geniar, November 18, 2014

Follow me on Twitter as @mattiasgeniar

I like HTTPerf. It’s a simply tool for a simply job: start HTTP calls and benchmark a remote system. But the CLI syntax for making it work with proxies is … cumbersome. So, here’s how to get it to work.

Say you want to benchmark “www.test.com” and you have a proxy running on your localhost port 8118.

$ httperf --server 127.0.0.1 \
 --port 8118 \
 --uri=http://www.test.com/page.html \
 --print-reply=header \
 --print-request=header \
 --debug 3 \
 --no-host-hdr \
 --add-header "Host: www.test.com"

There’s some debug information included above to show you what’s happening. Most importantly, the –no-host-hdr option prevents HTTPerf from adding it’s own Host: header, so you can use –add-header to add your own Host: header into the request.

The short version would be this.

$ httperf --server 127.0.0.1 \
 --port 8118 \
 --uri=http://www.test.com/page.html \
 --no-host-hdr \
 --add-header "Host: www.test.com"


Want to subscribe to the cron.weekly newsletter?

I write a weekly-ish newsletter on Linux, open source & webdevelopment called cron.weekly.

It features the latest news, guides & tutorials and new open source projects. You can sign up via email below.

No spam. Just some good, practical Linux & open source content.