Phuong Nguyen
Phuong Nguyen

Reputation: 3

JMeter Recording: 401 Unauthorized response after changed HTTP proxy to localhost

I just start learning JMeter. I'm trying to use JMeter to record my company websites, .NET web application.

My issue is that: For security, to access the websites, we have to config "Manual proxy configuration" to 10.x.x.x:3128. However, to record in JMeter I have to change the config to localhost, port 3128.

After I changed the config to localhost, I click Start button of HTTP Test Script Recorder then I click on any link, the Authorization dialog displays and I keep getting 401 unauthorized error although I enter correct username/password.

I tried to use HTTP Authorization Manager, HTTP Request Defaults or HTTP Request but they do not work.

Could anyone help me out?

Upvotes: 0

Views: 2975

Answers (1)

Dmitri T
Dmitri T

Reputation: 168147

If your company uses proxy for Internet access you can "tell" JMeter to use this proxy as well. So you need to perform the following configuration:

  1. Configure JMeter to use your proxy to access Internet via following command-line arguments (as per documentation):

    If you are testing from behind a firewall/proxy server, you may need to provide JMeter with the firewall/proxy server hostname and port number. To do so, run the jmeter[.bat] file from a command line with the following parameters:

    -H [proxy server hostname or ip address]

    -P [proxy server port]

    -N [nonproxy hosts] (e.g. *.apache.org|localhost)

    -u [username for proxy authentication - if required]

    -a [password for proxy authentication - if required]

    Example : jmeter -H my.proxy.server -P 8000 -u username -a password -N localhost

  2. Add HTTP(S) Test Script Recorder with default port of 8080 (or any other)

  3. Configure your browser to use JMeter host and port 8080 for accessing Internet. If there is No proxy for localhost, 127.0.0.1 stanza somewhere in browser's proxy configuration - untick or remove it in case of running browser and JMeter on the same machine. "Classic" Firefox configuration should look something like:

Firefox Recording Config

  1. It may be easier to use JMeter Chrome Extension, in that case you don't need to worry about proxy settings, SSL certificates and associated configuration, cookies, etc.

Upvotes: 0

Related Questions