Can I set multiple headers with Siege?
Asked Answered
T

3

18

I want to use siege to target a number of URLs on my app, each with different headers. I can set headers for one request

siege -u http://localhost/xyz -d1 -r1000 -c25 --header="Token: f2840fc1"

(this appears to be undocumented)

I can specify a list of URLs in the URL file, with custom headers for each URL. But I can't see a way in the docs.

Tire answered 20/12, 2013 at 15:31 Comment(3)
Did you ever find an answer?Centipede
I think the answer was no.Tire
while there is no way to set multiple headers for different URLs, you can set multiple headers for all URLs by saying siege --header="My1:Value1" --header="My2:Value2" -f urls.txtCentipede
E
13

I suggest using two concurrent calls to siege. Write a URL file that uses Header-A, and another for Header-B.

For my API testing, I've got a get_urls.txt file and post_json_urls.txt file, which I call on two instances of Siege at once. This way one gets called with Content-Type: text/json and the other doesn't. Short of rewriting the Siege url parser, this is the only way I know to do it.

For example:

siege -f get_urls.txt & siege -H 'Content-Type: text/json' -f post_json_urls.txt
Epiphragm answered 20/1, 2016 at 21:52 Comment(1)
Thanks, that's useful advice.Tire
T
5

As far as I can see from the man page and reading around I think you are right. The only way to specify headers is on the command line using the -H --header options not in the URL file.

Trichinosis answered 7/1, 2014 at 3:17 Comment(0)
M
1

You can try this example siege --concurrent=5 --reps=100 --header='sdk:3.0, config:3.0,zid:0' 'https://google.com/api/REGME POST uid=a8qn&aid=43ZK0'

Monaco answered 5/2, 2018 at 5:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.