Custom headers

The Recorder provides the capability to specify custom HTTP Request headers, including the user agent string. These headers can be customized before or after a transaction is recorded.

If the headers are customized before a transaction is recorded, the Recorder sends those headers as it records the transaction. If the User-Agent is modified, the recording browser not only sends the corresponding user-agent request header, the navigator.useragent property for the browser is also set to that user-agent.

Setting headers at record time is especially useful for these situations:

  • Setting a session cookie before recording – Use the custom headers to set the cookie header at record time, and later remove that header and add it in as a Cookie action after recording, to clean up the script.

  • Tricking a host into thinking another browser is making the request (if the site does not load in Firefox) – Sometimes, changing the User-Agent to make the recording browser send another browser's user-agent details is enough to trick the application into thinking the client is the other browser.

    This method does not work if the application is looking at information that cannot be changed at recording time (for example, navigator.appversion).

If the website is restricted to a non-Firefox browser, there is probably a reason for the restriction. Modifying the user-agent may load the application, but there may be some loss of functionality because of browser differences; so manual script modifications may still be required.