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:

  1. Open the .jmx test plan in the JMeter GUI.
  2. 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.

  3. Add HTTP Request Defaults from AddConfig ElementHTTP Request Defaults.
  4. Name the config element for the shared target service.
    Name: API request defaults
  5. 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.

  6. 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.

  7. 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.

  8. Save the test plan.
    http-defaults-demo.jmx
  9. 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
  10. 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
  11. 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.