jmeter Using JMeter behind a proxy

本文介绍了如何使用JMeter进行代理配置以通过防火墙或代理服务器进行测试。详细说明了通过命令行参数设置代理的方法,包括如何指定主机名、端口、非代理主机等,并提供了示例。此外还介绍了如何在测试计划中定义代理设置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

2.4.3 Using JMeter behind a proxy

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

You can also use --proxyHost , --proxyPort , --username , and --password as parameter names

Parameters provided on a command-line may be visible to other users on the system.

 

If the proxy host and port are provided, then JMeter sets the following System properties:

  • http.proxyHost
  • http.proxyPort
  • https.proxyHost
  • https.proxyPort
  • http.nonProxyHosts
  • https.nonProxyHosts

So if you don't wish to set both http and https proxies, you can define the relevant properties in system.properties instead of using the command-line parameters.

Proxy Settings can also be defined in a Test Plan, using either the HTTP Request Defaults configuration or the HTTP Request sampler elements.

JMeter also has its own in-built Proxy Server, the HTTP(S) Test Script Recorder . This is only used for recording HTTP or HTTPS browser sessions. This is not to be confused with the proxy settings described above, which are used when JMeter makes HTTP or HTTPS requests itself. 

转载于:https://www.cnblogs.com/wuxiaoxia/p/6322873.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值