Skip to content
Get Started
G2G2
4.7/5
Excellent
Trustpilot

How to use a proxy with Apache JMeter

Start JMeter with the proxy flags: jmeter -n -t plan.jmx -l results.jtl -H HOST -P PORT -u USERNAME -a PASSWORD. Every HTTP Request sampler in the plan then goes out through your CleanProxies IP; add -N with hosts that should stay direct.

  • Session Control
  • High Speed
  • Privacy First

What you need

Load and latency tests usually run from a server in one data center, which says little about how your own site answers real US visitors. Running a JMeter plan through CleanProxies static ISP proxies sends the test from IPs on real US carrier ASNs, so you can measure response times and check geo-dependent behavior from a US location. Only test sites and APIs you own or are allowed to test.

Your credential line

From the dashboard's proxy manager: host (or IP), port, username and password. Convert lists with the proxy list formatter.

Apache JMeter ready

  • Apache JMeter 5.x with Java installed (jmeter on macOS and Linux, jmeter.bat on Windows).
  • A test plan (.jmx) that targets a site or API you own or have permission to load test.

Which proxy fits Apache JMeter?

Both products use the same setup in Apache JMeter. What changes is how long an IP stays with you.

Recommended. Dedicated US ISP IPs stay fixed with unlimited bandwidth and threads, so long runs and repeated test cycles always start from the same location and results stay comparable.

starting from$0.75/IP

Dedicated static IPs registered to US and Canadian ISPs. The address stays the same for as long as you hold it, with unlimited bandwidth and HTTP(S) or SOCKS5 access.

Use a sticky residential line to check how your site answers from a specific country; keep thread counts modest because residential traffic is billed per GB. Rotating lines change IP between connections, which suits short geo spot checks rather than timed load tests.

starting from$0.63/GB

Residential IPs in 190+ countries with country, state and city targeting. Rotate on every request or hold a sticky session for up to 90 minutes; GB never expire.

credentials

Your CleanProxies credentials

Every product connects over HTTP(S); static ISP and ISP subnet proxies also run SOCKS5 and IP whitelisting. This is what the dashboard gives you to paste into Apache JMeter.

Static ISP and ISP subnetHTTP(S)SOCKS5IP whitelist
IP:PORT:USER:PASS

One line per dedicated IP. With IP whitelisting on, the line is just IP:PORT and no password is sent.

Rotating residential and mobileHTTP(S)User:pass
HOST:PORT:USER:PASS

Generated in the proxy manager. The username carries the location and session you pick, so generate a new list to change them.

As a URL, for code and most toolshttp://USERNAME:PASSWORD@HOST:PORTsocks5://USERNAME:PASSWORD@HOST:PORT

Use http:// even for HTTPS websites; the TLS session still runs end to end. The socks5:// form is for static ISP and ISP subnet proxies.

How to set up CleanProxies in Apache JMeter

Four steps, then check the exit IP with the free proxy checker.

  1. 1

    Prepare the test plan

    Build and save your plan in the JMeter GUI, then close the GUI: load tests should run in CLI mode.

  2. 2

    Add the proxy flags

    Run jmeter -n -t plan.jmx -l results.jtl -H HOST -P PORT -u USERNAME -a PASSWORD. -H and -P set the proxy host and port, -u and -a the proxy username and password.

  3. 3

    Exclude hosts that should stay direct

    Add -N with a pipe-separated list, for example -N "localhost|*.internal.example", for monitoring endpoints or backends you don't want to send through the proxy.

  4. 4

    Check the results

    Open results.jtl in a listener or generate the HTML report, and compare response times with a run from your own network.

copy & paste

Apache JMeter proxy examples

Replace the highlighted placeholders with the values from your dashboard. Pick an example to see its code.

Apache JMeter + CleanProxies

Run a test plan through the proxy

The proxy flags apply to the whole run. JMeter's own manual warns that command-line parameters may be visible to other users on the machine; with a static ISP proxy on IP whitelisting, authorize the load generator's IP and drop -u and -a.

CLI run with proxy authenticationShell
jmeter -n -t plan.jmx -l results.jtl \
  -H HOST -P PORT -u USERNAME -a PASSWORD \
  -N "localhost|127.0.0.1"
  • -e -o report writes the HTML dashboard to an empty report folder after the run. Long-form names also work: --proxyHost, --proxyPort, --username, --password, --nonProxyHosts.

Set the proxy per sampler instead

To send only some requests through the proxy, or different requests through different IPs, use the proxy fields of the HTTP Request sampler (or HTTP Request Defaults) on its Advanced tab: the proxy server name or IP (without http://), port, username and password.

  • The fields accept JMeter variables, so a CSV Data Set Config with one ISP proxy per line can spread threads across several dedicated US IPs.
  • The password is stored unencrypted in the .jmx file. Don't commit plans with real credentials; use variables or whitelisting.
  • Leave the fields empty when you use the -H / -P flags, so one setting controls the proxy.

Not the same as the HTTP(S) Test Script Recorder

JMeter's HTTP(S) Test Script Recorder is a proxy that runs inside JMeter: you point your browser at it to record clicks into samplers. It captures traffic and doesn't change where your test traffic exits. The -H / -P flags and the sampler proxy fields are the opposite direction: JMeter sends its own requests out through an upstream proxy, which is where your CleanProxies line goes.

fix it fast

Troubleshooting Apache JMeter proxy errors

Verify your exit IP

Add an HTTP Request sampler for https://api.ipify.org and a View Results Tree listener to a small plan, then start the JMeter GUI with the proxy flags and run it. The Response data tab shows the exit IP, which should be your proxy's address.

Open What is my IP? through the proxy to see the address and headers a website receives, or paste up to ten lines into the free proxy checker to test connectivity, latency and exit IP.

Still stuck? Our 24/7 support team answers fast: contact us with the error and the line you used (leave the password out).

Apache JMeter error fixes
  • 407 Proxy Authentication Required in the resultsWhy: -u / -a missing, or a typo in the password.Pass both flags with the credentials from your dashboard, or whitelist the load generator's IP on your ISP proxy.
  • Some samplers bypass the proxyWhy: The host matches -N, or a sampler has its own proxy fields set.Check the -N list and clear the per-sampler proxy fields when you rely on the flags.
  • Recorder set up but traffic still leaves from your IPWhy: The HTTP(S) Test Script Recorder only records; it isn't an upstream proxy.Use -H / -P (or the sampler proxy fields) with your CleanProxies host and port.
  • Connection errors under high thread countsWhy: The local machine runs out of sockets or memory before the proxy limits anything.Run in CLI mode with -n, raise the JVM heap and split very large tests across several load generators.

Apache JMeter proxy guides

Setup guides and best practices from the CleanProxies blog.

Get the latest insightsAll Blogs

More integrations

Setup guides for tools people run next to Apache JMeter.

All integrations

Apache JMeter proxy FAQs

Straight answers about running CleanProxies in Apache JMeter.

Start it with -H for the proxy host and -P for the port, plus -u and -a for the proxy username and password. For a load test, run in CLI mode: jmeter -n -t plan.jmx -l results.jtl -H HOST -P PORT -u USERNAME -a PASSWORD.

Got more questions?All FAQs