How to add HTTP proxy for apachebench (ab)
I want to capture http packets that ab is sending or receiving.
So, I add the http_proxy command in the shell:
$ export http_proxy=127.0.0.1:8888
Then I execute the ab command:
$ ab -c 1 -n 1 http://localhost/
Finally my proxy (127.0.0.1:8888) was unable to receive http packets from ab.
Is there a way to allow ab access to http via http_proxy?
Here is my environment: Mac OSX 10.10.3
+3
source to share
1 answer
If you read about ab help ab -h
, you will find that it supports the proxy option -X
:
-X proxy:port Proxyserver and port number to use
This option is equivalent to curl
-X
:
-x, --proxy [PROTOCOL://]HOST[:PORT] Use proxy on given port
And that leads to this command:
ab -c 1 -n 1 -X 127.0.0.1:8888 http://localhost/
+5
source to share