I answered my own question.
What I did was to explicitly send the OPTIONS & GET requests with the correct 
header information set rather than following redirects. This allowed the CORS 
header to be properly set on the file that was gotten so that other users were 
able to get it from cache without issue.

So here is what I did:

  *   I removed Follow Redirects from the original GET request
  *   Extracted the Location into 2 variables (URL and the rest of the 
location) from that original GET response header
  *   Added an OPTIONS request with the extracted URL and put the rest of the 
location in for the Path – do not Follow Redirects
  *   Added the following header values to he HTTP Header Manager under the 
OPTIONS request
     *   Access-Control-Request-Method: GET
     *   Access-Control-Request-Headers: origin
     *   Origin: https://<BaseURL>
  *   Added a GET with the same URL and Path as the OPTIONS request and same 
header values – do not Follow Redirects

I hope this will help someone else some day.
Beth


From: Beth Schrag <[email protected]>
Reply-To: JMeter Users List <[email protected]>
Date: Wednesday, November 18, 2020 at 11:46 AM
To: JMeter Users List <[email protected]>
Subject: CORS Redirect in JMeter

Hello,
I have a CORS-related question: Has anyone found a way to get JMeter to follow 
a redirect of a GET request by first sending an OPTIONS request with the 
appropriate CORS-related headers (Origin, Access-Control-Request-Headers, and 
Access-Control-Request-Method), followed by a GET request to the redirected URL?

It seems that JMeter doesn’t send the proper CORS-related headers on it’s own.

[[email protected]]<http://www.breaktech.com/>
Beth Schrag
Software Engineer
C: 847.363.7306
Breakthrough Technologies LLC
General:847.864.0033
Visit us at breaktech.com<http://www.breaktech.com/>
[[email protected]]<https://www.linkedin.com/company/breakthrough-technologies>
 [[email protected]] <https://twitter.com/break_tech>  
[[email protected]] 
<https://www.facebook.com/Breakthrough-Technologies-282856188427598/>

Confidential information may be contained in this message. If you are not the 
addressee indicated in the message, you should destroy this message. @2020 
Breakthrough Technologies, LLC.

Reply via email to