Re: Follow Redirects in JMeter

Dmitri T <[email protected]> Tue, 23 Jul 2024 07:57:31 +0200
Newsgroups gmane.comp.jakarta.jmeter.user
Message-ID <PH7PR12MB7139D85F338390B86F236A86C0A92@PH7PR12MB7139.namprd12.prod.outlook.com>
Sanjay Sharma wrote:
> Hi All,
>
> How can I handle 302 redirects in JMeter? I'm aware of the 'Follow
> Redirects' checkbox, but it isn't working. There are 3-4 302 requests
> followed by a final 200 request. How can I manage this in the script?
>
> I would appreciate the help!
>
> --
> Regards,
> *Sanjay Sharma*
>
If JMeter for any reason doesn't handle redirections automatically you 
can always extract the redirect URL from the Location header 
<https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location>

The URL can be extracted using suitable Post-Processor, i.e. Regular 
Expression Extractor 
<https://portal.perforce.com/s/article/Using-RegEx-Regular-Expression-Extractor-with-JMeter-1707509382883>, 
once done you can use the JMeter Variable from the Regular Expression 
Extractor in the next HTTP Request 
<https://jmeter.apache.org/usermanual/component_reference.html#HTTP_Request> 
sampler.