Make HTTPerf use a proxy for connections

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"