I am load-testing a page that has embedded resources. The test needs to load the page and its embedded resources. The page request needs to specify an HTTP header: a Host header, e.g. Host: abc. The embedded resources are in a different domain from my page, e.g. http://code.jquery.com/jquery.min.js

My JMeter plan has an HTTP Request sampler, which has a child HTTP Header Manager element that specifies the Host header. I'm using the "Retrieve All Embedded Resources" option on the HTTP Request.

The initial page request works as it should, but all the subsequent requests -- the ones to fetch the embedded resources -- fail with a 404. If I disable the HTTP Header Manager (i.e. if I don't send the Host header), the embedded resource requests work. Unfortunately, the test is invalid without that Host header.

So here's the question: is there a way to tell JMeter to use a header on the page request but not on the requests for the page's embedded resources?

I've looked through the JMeter docs, and I've tried Googling for "jmeter request header first request only".

I'm using JMeter 2.11 with the HttpClient4 HTTP Request implementation. The HttpClient3.1 and Java implementations behave similarly.

1 Answer 1


First of all, it is not a good idea to include external resources into your load test. You need to performance test your server, not code.jquery.com (unless you need to test code.jquery.com itself)

I would suggest to filter everything external like scripts, banners, etc. as it doesn't make any sense due to not having control of external resources performance.

See Excluding Certain Domains from the Load Test guide for more details.

If it applies to your server, this is not possible directly as in case of "Retrieve all embedded resources" option turned on the parent HTTPSamplerProxy is being cloned.

However you can work it around by breaking down main request and all requests to download embedded resources and combine them together via Transaction Controller to look like a single request in load report as follows:

  • Transaction Controller
    • Main Request
      • HTTP Header Manager (host: foo)
    • embedded resource 1
    • embedded resource 2
    • embedded resource ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.