Ophir Prusak
Ophir Prusak

Reputation: 1447

How do I modify the HTTP redirect in JMeter?

Here is the current scenario: I'm trying to run a JMeter script on my dev machine - dev.mysite.com and I'm running into an issue.

In production this works fine:

With a correct user / pass -
www.mysite.com/login.html
www.mysite.com/secure.html

With a bad user / pass -
www.mysite.com/login.html
server side redirect to www.mysite.com/login_failed.html

My problem is that the server side redirect has the hostname hardcoded So when I do this on my dev box I get:

With a correct user / pass -
dev.mysite.com/login.html
dev.mysite.com/secure.html

With a bad user / pass -
dev.mysite.com/login.html
server side redirect to www.mysite.com/login_failed.html (redirects to www)

I know I need to fix my code, but I'm looking for a work-around in JMeter.

Is this possible in JMeter?

Upvotes: 1

Views: 6983

Answers (1)

Santosh
Santosh

Reputation: 103

There is an option within the HTTP Request sampler to control redirects. There are two options. 1. Redirect Automatically (checkbox) and 2. Follow Redirects (checkbox). Uncheck these two check boxes to disable the redirects. You can then include a separate HTTP sampler to perform the redirects if you want by checking the status of the previous request. I face this situation in my projects and this is the technique I use to control redirects.

Upvotes: 2

Related Questions