HTTP Proxy Server in JMeter: Record Example Script

⚡ Smart Summary

JMeter HTTP Proxy Server records browser activity into a reusable test script. The recorder sits between browser and website, captures each request into a Recording Controller, and the saved plan is replayed by many virtual users.

  • 🎬 Core Purpose: The proxy watches and records user activity while a normal browser navigates the application under test.
  • 🧱 Plan Skeleton: Thread Group, HTTP Request Defaults, and Recording Controller are created before recording starts.
  • 🎯 Target Controller: This setting decides where captured samplers are written inside the test plan tree.
  • 🌐 Browser Setup: The browser must point its HTTP proxy at the JMeter port, 8888 by default.
  • 🔐 HTTPS Recording: Import ApacheJMeterTemporaryRootCA.crt as a trusted authority, then remove it afterwards.
  • 🧹 Clean the Script: Advertising and analytics requests are recorded too and should be excluded or deleted.
  • 🔗 Correlate Before Scaling: Replace recorded session tokens with extracted variables, or the replay fails.
  • ⚠️ Version Note: WorkBench was removed in JMeter 5.0; the element is now the HTTP(S) Test Script Recorder.

JMeter HTTP Proxy Server record script

What is the JMeter HTTP Proxy Server?

The JMeter HTTP Proxy Server is a built-in recorder that sits between the browser and the website under test. It watches and records user activity while the application is browsed normally, and turns each captured request into an HTTP Request sampler inside the test plan. Since JMeter 3.0 the element has been named the HTTP(S) Test Script Recorder, and both names describe the same component.

Record testing helps a tester record and replay activity against a test target. It is a type of automated testing, but for multiple users at once.

Why Record Instead of Building the Script by Hand?

A realistic user journey on a modern site produces dozens of requests, each with its own headers, cookies, and form parameters. Typing all of that into samplers by hand is slow and error prone. Recording captures the exact traffic the browser sent, which gives three advantages:

  • Accuracy: Header order, cookies, and hidden form fields are captured exactly as the server received them.
  • Speed: A ten-page journey takes minutes to record and hours to write manually.
  • Coverage: Background AJAX calls that are invisible in the interface still appear in the recording.

The recording is a starting point rather than a finished test. It still needs cleaning, correlating, and parameterising before it is usable for load testing. The sections below cover the full path from an empty JMeter window to a script that replays reliably.

Here is the roadmap of this practical example

HTTP Proxy Server in JMeter

How to Record a Script in JMeter 5.x

The current release is Apache JMeter 5.6.3, published on 9 January 2024, and it requires Java 8 or later, with Java 17 recommended. Anyone following the illustrated walkthrough further down this page on that release will not find a WorkBench node, because it was removed in version 5.0. The functionality did not disappear; it moved. The recorder is now added directly to the Test Plan and is called the HTTP(S) Test Script Recorder.

The fastest route is the bundled template. Choose File > Templates > Recording and JMeter generates a complete plan containing a Thread Group, HTTP Request Defaults, a Recording Controller, and the recorder itself, already wired together. Building the same structure by hand takes the steps below.

  1. Build the plan skeleton. Add a Thread Group, then add a Recording Controller under it. This is where captured samplers will land.
  2. Add the recorder to the Test Plan. Right click the Test Plan node and choose Add > Non-Test Elements > HTTP(S) Test Script Recorder. It is a sibling of the Thread Group, not a child.
  3. Set the port. The default is 8888. Any free port works, provided the browser is configured to match.
  4. Choose the Target Controller. Select the Recording Controller created in step one, so requests are grouped where you expect rather than scattered at the plan root.
  5. Add URL exclusion patterns. On the Requests Filtering tab, exclude static resources with a pattern such as .*\.(bmp|css|js|gif|ico|jpe?g|png|svg|woff2?). This removes most of the manual clean up described later.
  6. Start the recorder. Click Start at the top of the recorder panel. JMeter writes ApacheJMeterTemporaryRootCA.crt into its bin folder at this moment, which is what makes HTTPS recording possible.
  7. Point the browser at the proxy using localhost and the chosen port, then navigate the application normally.
  8. Stop and tidy. Press Stop, delete any remaining third party calls, and save the plan.
  9. Validate before scaling. Right click the Thread Group and choose Validate. This runs the plan once with a single thread, so failures surface before any load is applied.

One more habit separates a working script from a reliable one. Use the graphical interface for building and debugging only, then run the real test from the command line with jmeter -n -t plan.jmx -l results.jtl -e -o report, which also generates an HTML dashboard. The same command is the basis of distributed testing across several load generators. Installation is covered in the JMeter installation guide, and the full procedure is documented on the Apache JMeter recorder page.

⚠️ Version note: The screens in the walkthrough below were captured on an older JMeter release that still had the WorkBench node. WorkBench was removed in JMeter 5.0. Every concept still applies; only the location of the recorder changes, and the current procedure is the one given above.

Step 1) Setting the HTTP Proxy server

This is a Step-by-step guide to setup proxy

  1. Start JMeter
  2. Select Test Plan on the tree
  3. Add Thread Group. Right click on the Test Plan and add a new thread group: Add > Threads (Users) > Thread Group

Setting the HTTP Proxy server

  1. Add HTTP Request. Select the Thread Group; right click Add > Config Element > HTTP Request Defaults

Setting the HTTP Proxy server

In new HTTP Request Defaults element: In Server name or IP, enter “google.com”. You should keep the others fields blank

Setting the HTTP Proxy server

  1. Add Recording Controller. Right click on the “Thread Group” and add a recording controller: Add > Logic Controller > Recording Controller

Setting the HTTP Proxy server

  1. Add Proxy Server to WorkBench. Right click on the Workbench and add the http proxy: Add > Non-Test Elements > HTTP Proxy Server. On JMeter 5.x, right click the Test Plan node instead and choose HTTP(S) Test Script Recorder.

Setting the HTTP Proxy server

  1. Set Target Controller where your recorded scripts will be added

Setting the HTTP Proxy server

  1. Start Proxy Server. Return to HTTP Proxy Server, and click the Start button at the bottom. Now your JMeter proxy server start

Setting the HTTP Proxy server

  1. Start your Browser (I used Firefox), choose Tool > Option > Advanced > Network > Setting > Enter HTTP proxy as figure below. In current Firefox releases the same dialog is reached through Settings > General > Network Settings.

Setting the HTTP Proxy server

Step 2) Record your activity

  1. Now Launch http://www.google.com in your web browser (JMeter still open)
  2. Do activities search the keyword “guru99“.
  3. Back to JMeter, in HTTP Proxy Server, click Stop when finished

Record Activity

  1. After finishing recording, you will see JMeter automatically created a new HTTP request as the figure below

Record Activity

JMeter has already recorded a user request to the Home Page of Google website. http://www.google.com/

The other HTTP requests display in above figure, you should remove them. Because sometime JMeter also records some advertising links while you are searching keyword on Google. We should ignore them in our Test Plan.

  1. Click File > Save your Test Plan as

Record Activity

  1. A Dialog box display > enter a name of your test plan at File Name field > Click Save. Now your Test Plan is saved under name RecordingTestPlan.jmx

Record Activity

Step 3) Run your Test Plan

  1. Select Thread Group > Add > Listener > Summary Report

Run Test Plan

  1. The Summary Report will show some basic statics

Run Test Plan

  1. Select Thread Group, enter information as the figure below

Run Test Plan

You can refer the article JMeter Performance Testing to know the detail about Thread Group configuring.

  1. Before you start the test, select “Summary Report”. When you ready to run a test, select Run > Start (Ctrl+R). JMeter will playback your activity in 100 times. As the test runs, the statistics will change until the test is done.

Run Test Plan

Step 4) Save your test result

  1. Click Save Table Data to save test result to file

Save Test Result

  1. Enter the name of the test result and click Save. Test Result in JMeter is saved in *.csv format as default

Save Test Result

Download the File Recording Test Plan

Download the File HTTP Proxy Server

Recording HTTPS Traffic and Certificates

Almost every site now serves HTTPS, which the original walkthrough predates. A proxy cannot read encrypted traffic unless the browser trusts it, so one extra step is required.

When the recorder starts, JMeter generates a temporary root certificate named ApacheJMeterTemporaryRootCA.crt in its bin directory. Import that file into the browser as a trusted certificate authority, then restart the browser. JMeter can now present its own certificate for each site and decrypt the session for recording.

Three points are worth knowing:

  • The certificate expires after seven days. This is deliberate. Delete it and let JMeter regenerate a fresh one rather than extending the validity.
  • Remove it when finished. Leaving a trusted root certificate installed on a working machine is a genuine security risk, not a theoretical one.
  • Some applications refuse it. Sites using certificate pinning or mutual TLS cannot be recorded through a proxy at all, and the script must be built by hand from browser developer tools instead.

Correlation: Making a Recorded Script Replayable

A recorded script reproduces exactly what happened once, which is rarely what happens the second time. Session identifiers, tokens, and generated keys captured during recording are dead values by the time the script is replayed, and the run fails in ways that look like application errors.

Correlation is the fix. A post-processor such as the Regular Expression Extractor or the JSON Extractor captures the fresh value from the login response, stores it in a variable, and later requests reference that variable instead of the recorded literal.

The workflow is short:

  1. Replay the script once with a View Results Tree listener and find the first failing request.
  2. Compare the failing request against the recording. Any value that differs between two runs needs correlating.
  3. Add an extractor to the response that produced the value, then replace the hardcoded literal with the variable reference.
  4. Add an assertion so a page returning HTTP 200 with an error message still fails the test.

Only after correlation is the script safe to scale up. Running an uncorrelated recording at a hundred users measures error handling rather than performance. Further elements are covered across the JMeter tutorials.

Troubleshooting

If you face an issue while running the above scenario, do the following:

  1. Check whether you are connecting to the internet via a proxy. If yes, remove the proxy.
  2. Open a new instance of JMeter.
  3. Open the RecordingTestPlan.jmx in JMeter.
  4. Right click on Workbench > Merge > Select HTTP Proxy Server.jmx. On JMeter 5.x, merge into the Test Plan node instead, since WorkBench no longer exists.
  5. Click on Thread Group > Summary Report.
  6. Run the Test.

Two further symptoms account for most remaining failures. If the browser reports that it cannot connect, the recorder was never started, or the port set in the browser does not match the port set in JMeter. If pages load normally but nothing appears in the tree, the traffic is HTTPS and the certificate has not been imported.

FAQs

It was removed in JMeter 5.0. Non-test elements such as the HTTP(S) Test Script Recorder are now added directly under the Test Plan node instead.

Add URL patterns to exclude on the Requests Filtering tab of the recorder. A pattern covering common static file extensions removes most of the noise before it reaches the script.

AI classifies recorded samplers into business steps and third party noise, then proposes which to delete and which values need correlating, turning a raw capture into a usable script faster.

Yes. Given the response body and the value to capture, AI drafts a regular expression or boundary pair. Verify it in View Results Tree, since a pattern can match in one response and not another.

The browser does not trust the JMeter proxy. Import ApacheJMeterTemporaryRootCA.crt from the JMeter bin folder as a trusted authority, restart the browser, and record again.

Yes. Set the device Wi-Fi proxy to the recording machine IP and port, then install the JMeter certificate on the device. Applications that use certificate pinning still cannot be recorded.

No. The graphical interface is for building and debugging. Run the actual test in command line mode, which uses far less memory and produces an HTML report at the end.

Test plans are saved as .jmx, an XML format that works well in version control. Results are written as .jtl, which is CSV by default and can also be stored as XML.

Summarize this post with: