How do I override the value of the HTTP “Host” header in requests?
|For HTTP(s) targets, the Target Editor > Advanced Settings section includes an HTTP “Host” Header Override. This field is used in such cases to override the host header for all messages based on the given HTTP target.
To use this field, open the given HTTP target in the Target Editor, navigate to the Advanced Settings section and then enter the valid host name in the field as an URL and then save the target.
|The HTTP host override can also be set on the Target via the Composition Editor > Track (per track name) properties > HttpHostOverride field.|
|HTTP host overrides can also be performed via placement of a script calling the CloudTest system property,
Note that changing the value of the system property via the UI method, or via the deprecated script method, causes only the value in the HTTP “Host” header to be changed, and does not affect the actual location to which the requests are being sent.
This system property can be used to set the value that is sent in the HTTP “Host” header to the host name that the application is expecting. Changing the value of the
|Use the following steps to override host file(s) for a test using a script instead of the user interface.|
|With Central list > Scripts selected, click New and then create a script that contains the line code on the right. This script will perform a substitution of the IP address in the HTTP Request Header value for Host, to the desired hostname or domain name.|
|The script will take the value in the Target’s location, whatever it is, an IP or a domain name, and replace it at runtime with the value entered.||
|When the test composition is played, the host of the target will be overwritten with the system property set in the script. You can verify this substitution in the Composition Editor > Results tab > Result Details widget by selecting the target in the cover flow at the top and then clicking the Events List tab.|