I apologize - my question ended up requiring more detail than I was aware of at the time of asking. If anyone is interested, I solved this problem using this weird method:
Topology: Windows Client --> Fiddler Proxy on Windows Client --> Fiddler Reverse Proxy on man-in-the-middle --> Windows Server
Code in Windows Client CustomRules.js:
static function OnBeforeRequest(oSession: Session) {
//detect prefetch response
if (oSession.oRequest.headers.Exists("X-FiddlerPrefetch")) {
//dump response into a variable
oSession.utilDecodeRequest();
prefetchResponse = System.Text.Encoding.UTF8.GetString(oSession.requestBodyBytes);
}
//detect uri that was prefetched
if (oSession.uriContains("/some_uri")) {
//wait for prefetch - cant find any docs for how to 'sleep' here
// while (prefetchResponse === "") {
// Sleep(1);
// }
//use cached response
oSession.utilCreateResponseAndBypassServer();
oSession.utilSetResponseBody(prefetchResponse);
}
//redirect traffic to man-in-the-middle
if (oSession.HostnameIs("some_server")) {
oSession["x-overrideHost"] = "man-in-the-middle:443";
}
...
Code in man-in-the-middle CustomRules.js:
static function OnBeforeResponse(oSession: Session) {
//intercept response containing prefetch material
if (oSession.uriContains("some_response")) {
//parse response body for some prefetch info
...
//compose request
var request = "POST " + uri + " HTTP/1.1" + "\n" +
"X-FiddlerOpt: test\n" +
...
//send off to server
FiddlerObject.utilIssueRequest(request);
}
//detect the prefetch response, send to client
if (oSession.oRequest.headers.Exists("X-FiddlerOpt")) {
oSession.utilDecodeResponse();
var payload = System.Text.Encoding.UTF8.GetString(oSession.responseBodyBytes);;
//compose request
var request = "GET " + "http://windows_client:8888/ HTTP/1.1" + "\n" +
"Content-Length: " + payload.length + "\n" +
"X-FiddlerPrefetch: test\n" +
"\n" +
payload
//send request
FiddlerObject.utilIssueRequest(request);
}
...
As I'm sure there are simpler or better ways to do this, any feedback is welcome.