Kiran Kumar H N
Kiran Kumar H N

Reputation: 101

JMeter sends request without Auth Header than retries with Auth Header

On my JMeter script I am using the HTTP Authorization Manager, I observed that JMeter sends requests without Auth-Header and than retry with Auth-Header and successful. Is any settings to avoid this. Please let me know.

Jmeter sends Request1 with out Auth-Header - tcpdump shows 401 but not on Jmeter logs
Jmeter sends Request1 with Auth-Header - tcpdump and Jmeter logs shows 200 OK

Upvotes: 0

Views: 216

Answers (1)

Dmitri T
Dmitri T

Reputation: 168002

My expectation is that if you upgrade to JMeter 3.2 you should not see this issue anymore as according to the HTTP Authorization Manager documentation:

The HttpComponents (HC 4.5.X) implementation defaults to pre-emptive since 3.2 and the header will be shown

If for some reason you are not in position to upgrade to JMeter 3.2 or later (although it is highly recommended to use the most recent JMeter version) you can add the next line to user.properties file

httpclient4.auth.preemptive=true

See Preemptive Authentication stanza for more details.

Make sure you set "Implementation" of your HTTP Request sampler(s) to HttpClient4, the best way to set it is using HTTP Request Defaults and restart JMeter to pick the property up. Once done JMeter should send credentials even if it didn't receive unauthorized response. See Configuring JMeter chapter for more information.

Upvotes: 1

Related Questions