Load tests become harder to maintain when every HTTP Request sampler repeats the same protocol, host, and port. HTTP Request Defaults keeps shared HTTP connection fields in one scoped config element so several samplers can target the same application without copying the same values into each request.
The config element applies to HTTP samplers under the same scope, such as a Thread Group or a controller. A sampler inherits a field only when its own field is blank, so request-specific values remain visible on samplers that need a different path, host, method, timeout, or implementation.
Use defaults for values that are genuinely shared across the request group. Put endpoint-specific paths, payloads, assertions, and labels on the sampler so result rows still identify which application action was tested.
Steps to configure JMeter HTTP Request Defaults:
- Open the .jmx test plan in the JMeter GUI.
- Select the scope that owns the HTTP samplers.
Select the Thread Group for application-wide defaults. Select a controller when only one feature, transaction, or request group should inherit the values.
- Add HTTP Request Defaults from Add → Config Element → HTTP Request Defaults.
- Name the config element for the shared target service.
Name: API request defaults
- Set the shared HTTP fields.
Protocol: http Server Name or IP: api.example.net Port Number: 8080 Path: /api/catalog
Set Path only when samplers should inherit that exact endpoint path. A sampler path such as /status replaces the default path; JMeter does not prepend the default path as a base prefix.
- Leave inherited fields blank on samplers that should use the defaults.
Name: GET inherited default path Method: GET Protocol: (blank) Server Name or IP: (blank) Port Number: (blank) Path: (blank) Parameter: from=defaults
A blank sampler path inherits /api/catalog from HTTP Request Defaults. The sampler parameter remains request-specific.
- Set sampler-specific fields only where the request must override a default.
Name: GET sampler path override Method: GET Protocol: (blank) Server Name or IP: (blank) Port Number: (blank) Path: /status
The sampler still inherits http, api.example.net, and port 8080 while replacing the default path with /status.
- Save the test plan.
http-defaults-demo.jmx
- Run a one-user non-GUI smoke test.
$ jmeter -n -t http-defaults-demo.jmx -l http-defaults-results.jtl Creating summariser <summary> Created the tree successfully using http-defaults-demo.jmx Starting standalone test @ 2026 Jun 30 00:18:08 GMT Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4445 summary = 2 in 00:00:00 = 23.8/s Avg: 8 Min: 1 Max: 16 Err: 0 (0.00%) Tidying up ... ... end of run
- Check the .jtl result file for resolved URLs.
$ cat http-defaults-results.jtl timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,URL,Latency,IdleTime,Connect 1782778688202,16,GET inherited default path,200,OK,HTTP defaults smoke users 1-1,text,true,,85,148,1,1,http://api.example.net:8080/api/catalog?from=defaults,13,0,11 1782778688218,1,GET sampler path override,200,OK,HTTP defaults smoke users 1-1,text,true,,85,129,1,1,http://api.example.net:8080/status,1,0,1
- Check the target server log or request inspector.
$ cat http-defaults-server.log GET /api/catalog?from=defaults Host: api.example.net:8080 -> 200 GET /status Host: api.example.net:8080 -> 200
The first row confirms that blank sampler fields inherited the protocol, host, port, and default path. The second row confirms that the sampler-specific /status path replaced only the default path while keeping the shared host and port.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.