I am trying to use JMeter to load test a web login form running on a local VM, but I keep getting a 401 Unauthorized response. I setup a JMeter proxy to record the steps then added the HTTP Cookie Manager but it still will not authenticate.




The Cookie Manager gets used and adds the _auth_session to the request but the login still fails. The initial request is a POST method passing the username/password info. I can’t seem to figure out why it’s not actually authenticating. When I record the steps it works fine but playback fails. This appears to be a headless browser issue because recording the same steps in Selenium IDE plays it back perfectly and there is no 401 response. Any ideas would be much appreciated!
Running Windows 7/64
I finally found the answer to my problems, so if anyone else experiences the same hardships please check this site out.
http://ertw.com/blog/2010/06/29/load-testing-a-rails-app-and-the-authenticity_token/
The problem I was having is authenticating against a Rails web app that had a hidden authenticity_token element. A regular expression is needed to extract the dynamic value and then include it in the form post in JMeter.