Skip to content

Proxy Configuration

Mark Collin edited this page Jun 14, 2022 · 20 revisions

#Setting the <proxyConfig>

If you configure proxy settings to be used by JMeter, the proxy settings will be used to run every test.

Setting a proxy host is mandatory, if you do not set a proxy host the rest of the proxy configuration will be ignored. If you do not set a proxy port it will always default to port 80.

<username> and <password> are optional settings that do not have to be set.

You can also set an optional <hostExclusions> element to notify JMeter of hosts that should not be proxied, this is a regular expression based setting.

<project>
    [...]
        <build>
            <plugins>
                <plugin>
                    <groupId>com.lazerycode.jmeter</groupId>
                    <artifactId>jmeter-maven-plugin</artifactId>
                    <version>3.6.0</version>
                    <executions>
                        <!-- Generate JMeter configuration -->
                        <execution>
                            <id>configuration</id>
                            <goals>
                                <goal>configure</goal>
                            </goals>
                        </execution>
                        <!-- Run JMeter tests -->
                        <execution>
                            <id>jmeter-tests</id>
                            <goals>
                                <goal>jmeter</goal>
                            </goals>
                        </execution>
                        <!-- Fail build on errors in test -->
                        <execution>
                            <id>jmeter-check-results</id>
                            <goals>
                                <goal>results</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <proxyConfig>
                            <host>10.10.10.53</host>
                            <port>80</port>
                            <username>jimbob</username>
                            <password>correct horse battery staple</password>
                            <hostExclusions>localhost|*.lazerycode.com</hostExclusions>
                        </proxyConfig>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    [...]
</project>

For SOCKS proxy configuration, see Configuring the jvm that the jmeter process runs in.