jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fitzpatrick, Adrian" <>
Subject RE: Redirects on HTTP Request
Date Tue, 20 Jan 2009 18:50:43 GMT

Hi David,

Interesting question! I haven't tried this, but it might be possible to
achieve this something like:

- Put each HTTP request sampler which can have redirects in a while loop
controller, with a boolean flag controlling whether the loop should be
execute. Intially set this flag to TRUE
- Set the server part of the URL for the sampler to the correct server
address, and the path part to a variable - say call it URL_PATH. Initialise
URL_PATH to the initial path - "/someapp/servlet" per your example
- Add a bean shell post processor (BSPP) to the sampler. The BSPP should
check the response from the sample to see if it a redirect. If so, it should
update URL_PATH to the redirect location. If not, the BSPP should set the
loop control variable to FALSE

I THINK this structure would allow to follow redirects on the same server to
an infinite depth. Its fairly convoluted, so there may well be a much easier
way! However, once you have it working for 1 URL, it should be the same for
all others.

Let me know how you get on!

- Adrian

-----Original Message-----
From: David Provan []
Sent: 20 January 2009 17:28
To: JMeter List
Subject: RE: Redirects on HTTP Request


I considered this, however the product we're testing against can throw 1 to n
redirects (the largest number I have seen so far is 7 in a row).  Otherwise
that would work nicely!

For example

/someapp/servlet redirects to /someapp/another_servlet redirects to
/someapp/next_servlet redirects to /someapp/final_servlet



> Subject: RE: Redirects on HTTP Request
> Date: Tue, 20 Jan 2009 12:24:25 -0500
> From:
> To:
> Why not follow the redirect manually rather then automatically?  Extract
> the path from the response header with regex and feed that as your path
> into the next sample.  How can Jmeter know which server you want to hit?
> You need to tell it explicitly.
> -----Original Message-----
> From: David Provan [] 
> Sent: Tuesday, January 20, 2009 12:17 PM
> To: JMeter List
> Subject: Redirects on HTTP Request
> Hi,
> I am using HTTP Request nodes to sample against a site however we have
> come accross an issue when redirecting.
> I have multiple HTTP Servers so to ensure I "hit" the correct one I use
> the HTTP Header Manager to set a "Host" attribute in the HTTP Request
> sample set the IP address to hit
> e.g.
> The code I am hitting then sends a redirect which JMeter will
> automatically follow, however the returning redirect contains the host
> not the IP address so I no longer can be sure of the web server I am
> testing against.
> For example.
> I request (Host: header set to
> This returns a redirect of
> Is it possible in JMeter to replace the returned in the
> redirect URL with the IP address?
> Thanks in advance for any assistance.
> David Provan
> _________________________________________________________________
> Choose the perfect PC or mobile phone for you
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Are you a PC?  Upload your PC story and show the world


This message has been delivered to the Internet by the Revenue Internet e-mail service (OP)


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message