• Dynatrace Recorder



I want to generate unique host headers every time a script runs. How can I do it?


Add a GUID to a host header by using JavaScript, such as the example below, in a Custom action.

See Custom actions in the help pages for more information.



  1. Anonymous (login to see details)

    To me, this "solution" misses the most important part: how to get the generated 'id' into the HTTP headers.

    Stack Overflow provides a detailed discussion of the more universal aspect of this question (how to generate a UUID in JavaScript):

    In my opinion, what this solution needs (and what I need but which this answer glosses over behind a comment) is the "specific to your product" answer to: how do I get this 'id' (whatever it contains) into the HTTP headers for all the requests in the script?


  2. Anonymous (login to see details)

    After working with the team at Compuware, here is the necessary JavaScript for the end of the Custom Action (replaces the "// how to use the variable 'id' in the HTTP headers" comment in the example above):

    var send = new AddEventHookCommand({
      "eventType": "sendingRequest",
      "name": "agIDs",
      "handler": "request.replaceHeader('X-Header-Name-Here', id)"